From 819ea61b4d3a81a6c9e5a18850842ffdfdb7aa36 Mon Sep 17 00:00:00 2001 From: nazunalika Date: Sun, 27 Mar 2022 20:04:38 -0700 Subject: [PATCH] use FQCN --- .ansible-lint | 8 +++--- ...fig.yaml => .pre-commit-config.yaml.backup | 0 defaults/main.yml | 6 ++--- github/workflows/ansible-lint.yml | 1 + meta/main.yml | 3 +++ molecule/default/converge.yml | 13 ---------- molecule/default/molecule.yml | 26 ------------------- molecule/requirements.yml | 3 --- tasks/main.yml | 20 +++++++------- tasks/users.yml | 2 +- 10 files changed, 23 insertions(+), 59 deletions(-) rename .pre-commit-config.yaml => .pre-commit-config.yaml.backup (100%) delete mode 100644 molecule/default/converge.yml delete mode 100644 molecule/default/molecule.yml delete mode 100644 molecule/requirements.yml diff --git a/.ansible-lint b/.ansible-lint index a998c16..56c1219 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,5 +1,7 @@ +--- warn_list: - - '204' # Lines should be less than 160 characters - - '701' # meta/main.yml should contain relevant info + - '701' skip_list: - - '106' # Role name must match ^[a-z][a-z0-9_]+$ pattern + - '204' + - '106' +... diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml.backup similarity index 100% rename from .pre-commit-config.yaml rename to .pre-commit-config.yaml.backup diff --git a/defaults/main.yml b/defaults/main.yml index 97c50f9..b84c65b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -36,11 +36,11 @@ rabbitmq_plugins: - rabbitmq_peer_discovery_common # If you want monitoring, set these in your playbooks -#rabbitmq_monitoring_username: mq-monitoring -#rabbitmq_monitoring_password: NotASafePassword +# rabbitmq_monitoring_username: mq-monitoring +# rabbitmq_monitoring_password: NotASafePassword # Enable the public pubsub or not rabbitmq_enable_public: false -#pubsub_federation_pass: ... +# pubsub_federation_pass: ... rabbitmq_mbs_password: "ThisIsNotThePassword!" diff --git a/github/workflows/ansible-lint.yml b/github/workflows/ansible-lint.yml index 9b4c497..f5fdb2f 100644 --- a/github/workflows/ansible-lint.yml +++ b/github/workflows/ansible-lint.yml @@ -21,6 +21,7 @@ jobs: run: | echo '[defaults]' > ansible.cfg echo 'collections_paths = ./collections' >> ansible.cfg + - name: Install role requirements run: ansible-galaxy role install -r molecule/requirements.yml # TODO: Figure out how to get this not to error so this action is universal diff --git a/meta/main.yml b/meta/main.yml index 3b9438e..71f8525 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -9,6 +9,9 @@ galaxy_info: - name: EL versions: - 8 + - 9 galaxy_tags: [] dependencies: + - ansible.posix + - community.general - community.rabbitmq diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml deleted file mode 100644 index e3de332..0000000 --- a/molecule/default/converge.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Converge - hosts: all - become: true - - pre_tasks: - - name: Update apt cache. - apt: update_cache=true cache_valid_time=600 - when: ansible_os_family == 'Debian' - changed_when: false - - roles: - - role: ansible-role-mycoolrole diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml deleted file mode 100644 index ce89169..0000000 --- a/molecule/default/molecule.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -dependency: - name: galaxy - options: - ignore-certs: true - role-file: molecule/requirements.yml - -driver: - name: docker - -# lint: | -# set -e -# yamllint . -# ansible-lint -platforms: - - name: instance - image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" - command: ${MOLECULE_DOCKER_COMMAND:-""} - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true -provisioner: - name: ansible - playbooks: - converge: ${MOLECULE_PLAYBOOK:-converge.yml} diff --git a/molecule/requirements.yml b/molecule/requirements.yml deleted file mode 100644 index 4d08b50..0000000 --- a/molecule/requirements.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -roles: - ## Deps go here Should be very short and only if Absolutely needed diff --git a/tasks/main.yml b/tasks/main.yml index cea9fd2..8552ea1 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ --- # RabbitMQ Tasks - name: Install required packages for RabbitMQ - yum: + ansible.builtin.dnf: name: rabbitmq-server state: present @@ -12,7 +12,7 @@ state: true - name: Deploy RabbitMQ configuration - template: + ansible.builtin.template: src: "etc/rabbitmq/{{ item }}.j2" dest: "/etc/rabbitmq/{{ item }}" owner: rabbitmq @@ -25,7 +25,7 @@ - restart_rabbitmq - name: Deploy erlang cookie - copy: + ansible.builtin.copy: owner: rabbitmq group: rabbitmq mode: '0600' @@ -35,7 +35,7 @@ - restart_rabbitmq - name: Create systemd override for RabbitMQ - file: + ansible.builtin.file: path: /etc/systemd/system/rabbitmq-server.service.d state: directory owner: root @@ -43,7 +43,7 @@ mode: '0755' - name: Override nofile limit for RabbitMQ - copy: + ansible.builtin.copy: dest: /etc/systemd/system/rabbitmq-server.service.d/99-override.conf owner: root group: root @@ -54,11 +54,11 @@ # We are doing it the command line way - name: Enable RabbitMQ Plugins - command: "rabbitmq-plugins enable {{ rabbitmq_plugins | join(' ') }}" + ansible.builtin.command: "rabbitmq-plugins enable {{ rabbitmq_plugins | join(' ') }}" changed_when: "1 != 1" - name: Ensure file ownership for plugins - file: + ansible.builtin.file: path: /etc/rabbitmq/enabled_plugins owner: rabbitmq group: rabbitmq @@ -66,7 +66,7 @@ state: file - name: Ensure file ownership for certificate - file: + ansible.builtin.file: path: "{{ item }}" owner: rabbitmq group: rabbitmq @@ -93,7 +93,7 @@ - 35672-35682/tcp - name: Non-master nodes should wait for 001 to be up first - wait_for: + ansible.builtin.wait_for: host: "{{ rabbitmq_cluster_list[0] }}" port: '5672' delay: '15' @@ -102,7 +102,7 @@ when: "'rabbitmq001' not in inventory_hostname" - name: Ensure RabbitMQ is running - service: + ansible.builtin.service: name: rabbitmq-server state: started enabled: true diff --git a/tasks/users.yml b/tasks/users.yml index 1b899df..f77e1c5 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -26,7 +26,7 @@ - rabbitmq_cluster - name: Drop the admin password in a file for admin operations - copy: + ansible.builtin.copy: dest: /root/.rabbitmqpass content: "{{ rabbitmq_admin_password }}" mode: '0600'