From 76d8716968738e0f8aa6632b3547f3f043fbc0cd Mon Sep 17 00:00:00 2001 From: Ruslan Aliev Date: Sat, 16 May 2020 01:48:42 -0500 Subject: [PATCH] Replace become: true notation Ansible documentation recommends to use yes/no as boolean value, the last mention of possible using true/yes related to version 2.4 [1]. Starting from version 2.5 only become: yes specified in docs [2][3]. Since we have both variations, this patch aligns become statement to use only yes value. [1] https://docs.ansible.com/ansible/2.4/become.html [2] https://docs.ansible.com/ansible/2.5/user_guide/become.html [3] https://docs.ansible.com/ansible/latest/user_guide/become.html Change-Id: I706e6e1b9d706d6bfcc38c1a3d0d7304575946ce Signed-off-by: Ruslan Aliev --- playbooks/airship-airshipctl-build-gate.yaml | 2 +- roles/airship-gather-apache-logs/tasks/main.yaml | 8 ++++---- .../airship-gather-libvirt-logs/tasks/main.yaml | 6 +++--- .../airship-gather-runtime-logs/tasks/main.yaml | 4 ++-- .../tasks/main.yml | 2 +- roles/apache-file-exchanger/tasks/main.yaml | 2 +- roles/apache-server/handlers/main.yaml | 6 +++--- roles/apache-server/tasks/htaccess.yaml | 2 +- roles/apache-server/tasks/htpasswd.yaml | 2 +- roles/apache-server/tasks/install.yaml | 16 ++++++++-------- roles/apache-server/tasks/restart.yaml | 2 +- roles/apache-server/tasks/ssl.yaml | 2 +- .../tasks/backend.yaml | 2 +- .../tasks/frontend.yaml | 2 +- roles/docker-install/tasks/main.yaml | 16 ++++++++-------- roles/libvirt-domain/tasks/autodetect.yaml | 2 +- roles/libvirt-domain/tasks/domain.yaml | 2 +- roles/libvirt-install/tasks/configure.yaml | 2 +- roles/libvirt-install/tasks/main.yaml | 8 ++++---- roles/libvirt-network/tests/main.yaml | 12 ++++++------ 20 files changed, 50 insertions(+), 50 deletions(-) diff --git a/playbooks/airship-airshipctl-build-gate.yaml b/playbooks/airship-airshipctl-build-gate.yaml index cf8ad5d47..20376622c 100644 --- a/playbooks/airship-airshipctl-build-gate.yaml +++ b/playbooks/airship-airshipctl-build-gate.yaml @@ -29,7 +29,7 @@ state: directory mode: "0755" owner: "{{ ansible_user }}" - become: true + become: yes - name: deploy-gate include_role: diff --git a/roles/airship-gather-apache-logs/tasks/main.yaml b/roles/airship-gather-apache-logs/tasks/main.yaml index 41d8b76dc..9da31c7fd 100644 --- a/roles/airship-gather-apache-logs/tasks/main.yaml +++ b/roles/airship-gather-apache-logs/tasks/main.yaml @@ -25,15 +25,15 @@ args: executable: /bin/bash ignore_errors: True - become: true + become: yes - name: copy configs command: "cp -r /etc/apache2 {{ apache_log_dir }}/configs" - become: true + become: yes - name: copy logs command: "cp -r /var/log/apache2 {{ apache_log_dir }}/logs" - become: true + become: yes - name: Change ownership of the logs dir file: @@ -41,7 +41,7 @@ recurse: true owner: "{{ ansible_user }}" path: "{{ apache_log_dir }}" - become: true + become: yes - name: "Downloads logs to executor" synchronize: diff --git a/roles/airship-gather-libvirt-logs/tasks/main.yaml b/roles/airship-gather-libvirt-logs/tasks/main.yaml index ea7307e17..d157fb0d8 100644 --- a/roles/airship-gather-libvirt-logs/tasks/main.yaml +++ b/roles/airship-gather-libvirt-logs/tasks/main.yaml @@ -25,11 +25,11 @@ - name: copy hypervisor logs to tmp directory command: "cp -r /var/log/libvirt {{ libvirt_log_dir }}/libvirt-hypervisor" - become: true + become: yes - name: copy console logs to tmp directory command: "cp -r /var/log/libvirt-consoles/ {{ libvirt_log_dir }}/libvirt-consoles" - become: true + become: yes - name: ensure libvirt resource dump directories exist file: @@ -102,7 +102,7 @@ recurse: true owner: "{{ ansible_user }}" path: "{{ libvirt_log_dir }}" - become: true + become: yes - name: Downloads logs to executor synchronize: diff --git a/roles/airship-gather-runtime-logs/tasks/main.yaml b/roles/airship-gather-runtime-logs/tasks/main.yaml index 84a3f12f9..c13e33de9 100644 --- a/roles/airship-gather-runtime-logs/tasks/main.yaml +++ b/roles/airship-gather-runtime-logs/tasks/main.yaml @@ -28,7 +28,7 @@ when: ansible_facts.services['docker.service'] is defined args: executable: /bin/bash - become: true + become: yes - name: dump containerd logs shell: |- @@ -36,7 +36,7 @@ when: ansible_facts.services['containerd.service'] is defined args: executable: /bin/bash - become: true + become: yes - name: "Downloads logs to executor" synchronize: diff --git a/roles/airshipctl-build-ephemeral-iso/tasks/main.yml b/roles/airshipctl-build-ephemeral-iso/tasks/main.yml index b7034788e..923b65cfd 100644 --- a/roles/airshipctl-build-ephemeral-iso/tasks/main.yml +++ b/roles/airshipctl-build-ephemeral-iso/tasks/main.yml @@ -16,7 +16,7 @@ state: directory mode: "0755" owner: "{{ ansible_user }}" - become: true + become: yes - name: build ephemeral node iso command: airshipctl baremetal isogen diff --git a/roles/apache-file-exchanger/tasks/main.yaml b/roles/apache-file-exchanger/tasks/main.yaml index ae24dc6cc..49755cb77 100644 --- a/roles/apache-file-exchanger/tasks/main.yaml +++ b/roles/apache-file-exchanger/tasks/main.yaml @@ -17,7 +17,7 @@ msg: "Only Debian|Ubuntu are currently supported" - name: Confguring file-exchanger - become: true + become: yes block: - name: Ensure backend diff --git a/roles/apache-server/handlers/main.yaml b/roles/apache-server/handlers/main.yaml index f8f661094..a5ab6b487 100644 --- a/roles/apache-server/handlers/main.yaml +++ b/roles/apache-server/handlers/main.yaml @@ -16,16 +16,16 @@ service: name: "apache2" state: "restarted" - become: true + become: yes - name: reload apache2 service: name: "apache2" state: "reloaded" - become: true + become: yes - name: "restart httpd" service: name: "httpd" state: "restarted" - become: true + become: yes diff --git a/roles/apache-server/tasks/htaccess.yaml b/roles/apache-server/tasks/htaccess.yaml index 16bd45093..cb29a04bf 100644 --- a/roles/apache-server/tasks/htaccess.yaml +++ b/roles/apache-server/tasks/htaccess.yaml @@ -11,7 +11,7 @@ # limitations under the License. - name: Generate htaccess file - become: true + become: yes template: src: htaccess.j2 dest: "{{ apache_server_htaccess_path }}" diff --git a/roles/apache-server/tasks/htpasswd.yaml b/roles/apache-server/tasks/htpasswd.yaml index 47d5f16e3..e9869ccd3 100644 --- a/roles/apache-server/tasks/htpasswd.yaml +++ b/roles/apache-server/tasks/htpasswd.yaml @@ -12,7 +12,7 @@ - name: Confguring htpasswd - become: true + become: yes block: - name: Ensure needed packages apt: diff --git a/roles/apache-server/tasks/install.yaml b/roles/apache-server/tasks/install.yaml index d0804622c..18503fac4 100644 --- a/roles/apache-server/tasks/install.yaml +++ b/roles/apache-server/tasks/install.yaml @@ -12,7 +12,7 @@ --- - name: redhat | ensuring apache packages are present - become: true + become: yes when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' yum: name: @@ -21,7 +21,7 @@ state: present - name: ubuntu | ensuring apache packages are present - become: true + become: yes when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' apt: name: @@ -30,25 +30,25 @@ state: present - name: Disable default virtual host - become: true + become: yes command: a2dissite 000-default - name: Enable ssl module - become: true + become: yes command: a2enmod headers ssl - name: Add ssl configuration - become: true + become: yes template: src: ssl-params.conf.j2 dest: /etc/apache2/conf-available/ssl-params.conf - name: Enable ssl configuration - become: true + become: yes command: a2enconf ssl-params - name: redhat | enabling apache on boot and starting - become: true + become: yes when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' service: name: httpd @@ -56,7 +56,7 @@ enabled: true - name: Reload apache2 service - become: true + become: yes when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' service: name: apache2 diff --git a/roles/apache-server/tasks/restart.yaml b/roles/apache-server/tasks/restart.yaml index afc515ca5..c10f7c106 100644 --- a/roles/apache-server/tasks/restart.yaml +++ b/roles/apache-server/tasks/restart.yaml @@ -11,7 +11,7 @@ # limitations under the License. - name: Reload apache2 service - become: true + become: yes service: name: apache2 state: reloaded diff --git a/roles/apache-server/tasks/ssl.yaml b/roles/apache-server/tasks/ssl.yaml index a133916a5..e815dadf6 100644 --- a/roles/apache-server/tasks/ssl.yaml +++ b/roles/apache-server/tasks/ssl.yaml @@ -11,7 +11,7 @@ # limitations under the License. - name: Generating ssl key & certificate - become: true + become: yes block: - name: Ensure needed packages apt: diff --git a/roles/apache-wsgi-sushy-emulator/tasks/backend.yaml b/roles/apache-wsgi-sushy-emulator/tasks/backend.yaml index cac35c00e..7df5c293d 100644 --- a/roles/apache-wsgi-sushy-emulator/tasks/backend.yaml +++ b/roles/apache-wsgi-sushy-emulator/tasks/backend.yaml @@ -16,7 +16,7 @@ msg: "Only Debian|Ubuntu are currently supported" - name: Preparing wsgi module for sushy-emulator - become: true + become: yes block: - name: Ensure Apache diff --git a/roles/apache-wsgi-sushy-emulator/tasks/frontend.yaml b/roles/apache-wsgi-sushy-emulator/tasks/frontend.yaml index 0d5dffc3d..47f7d2c95 100644 --- a/roles/apache-wsgi-sushy-emulator/tasks/frontend.yaml +++ b/roles/apache-wsgi-sushy-emulator/tasks/frontend.yaml @@ -17,7 +17,7 @@ msg: "Only Debian|Ubuntu are currently supported" - name: Confguring sushy-emulator frontend - become: true + become: yes block: - name: Ensure sushy-emulator backend include_role: diff --git a/roles/docker-install/tasks/main.yaml b/roles/docker-install/tasks/main.yaml index 98d9c99c6..428d3338f 100644 --- a/roles/docker-install/tasks/main.yaml +++ b/roles/docker-install/tasks/main.yaml @@ -12,7 +12,7 @@ --- - name: Ensuring docker and support packages are present - become: true + become: yes when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' yum: name: @@ -22,7 +22,7 @@ state: present - name: Ensuring docker and support packages are present - become: true + become: yes when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' apt: name: @@ -37,7 +37,7 @@ state: present - name: Add user "{{ ansible_user }}" to docker group - become: true + become: yes user: name: "{{ ansible_user }}" groups: @@ -60,23 +60,23 @@ src: http-proxy-conf.j2 dest: /etc/systemd/system/docker.service.d/http-proxy.conf when: proxy.enabled|bool == true - become: true + become: yes - name: Create docker directory file: path: "{{ docker_config_path }}" state: directory mode: '0755' - become: true + become: yes - name: Save docker daemon configuration copy: content: "{{ docker_config | to_nice_json }}" dest: "{{ docker_config_path }}/daemon.json" - become: true + become: yes - name: Start docker - become: true + become: yes systemd: name: docker state: restarted @@ -84,7 +84,7 @@ enabled: true - name: Change group ownership on docker sock - become: true + become: yes file: path: /var/run/docker.sock group: docker diff --git a/roles/libvirt-domain/tasks/autodetect.yaml b/roles/libvirt-domain/tasks/autodetect.yaml index 49211c845..af93a065d 100644 --- a/roles/libvirt-domain/tasks/autodetect.yaml +++ b/roles/libvirt-domain/tasks/autodetect.yaml @@ -16,7 +16,7 @@ - name: Load the kvm kernel module modprobe: name: kvm - become: true + become: yes failed_when: false - name: Check for the KVM device diff --git a/roles/libvirt-domain/tasks/domain.yaml b/roles/libvirt-domain/tasks/domain.yaml index afd61206b..91a587987 100644 --- a/roles/libvirt-domain/tasks/domain.yaml +++ b/roles/libvirt-domain/tasks/domain.yaml @@ -17,7 +17,7 @@ state: directory recurse: true mode: 0770 - become: true + become: yes when: "libvirt_domain.console_log_enabled | default(false)" - name: Validate VM interfaces diff --git a/roles/libvirt-install/tasks/configure.yaml b/roles/libvirt-install/tasks/configure.yaml index 1e7fd6f50..58d8e0662 100644 --- a/roles/libvirt-install/tasks/configure.yaml +++ b/roles/libvirt-install/tasks/configure.yaml @@ -11,7 +11,7 @@ # limitations under the License. - name: configure libvirt - become: true + become: yes block: - name: Set libvirt security driver lineinfile: diff --git a/roles/libvirt-install/tasks/main.yaml b/roles/libvirt-install/tasks/main.yaml index 05ce2b60a..082dc777a 100644 --- a/roles/libvirt-install/tasks/main.yaml +++ b/roles/libvirt-install/tasks/main.yaml @@ -13,7 +13,7 @@ --- - block: - name: Ensuring Libvirt, Qemu and support packages are present - become: true + become: yes when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' yum: name: @@ -24,7 +24,7 @@ - qemu-kvm state: present - name: Ensuring Libvirt, Qemu and support packages are present - become: true + become: yes when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' apt: name: @@ -38,7 +38,7 @@ - ebtables state: present - name: Add user "{{ ansible_user }}" to libvirt group - become: true + become: yes user: name: "{{ ansible_user }}" groups: @@ -52,5 +52,5 @@ name: libvirtd state: started enabled: true - become: true + become: yes diff --git a/roles/libvirt-network/tests/main.yaml b/roles/libvirt-network/tests/main.yaml index 2b3635156..6c463b08b 100644 --- a/roles/libvirt-network/tests/main.yaml +++ b/roles/libvirt-network/tests/main.yaml @@ -29,7 +29,7 @@ name: - bridge-utils state: present - become: true + become: yes - name: gather network info virt_net: command: info @@ -94,7 +94,7 @@ - name: Create virtual ethernet interface command: ip link add name air02 type veth peer name air01 - become: true + become: yes changed_when: - "create_veth_command.rc != 2" - "'RTNETLINK answers: File exists' not in (create_veth_command.stderr | default(''))" @@ -103,14 +103,14 @@ - "create_veth_command.rc != 0" - "'RTNETLINK answers: File exists' not in (create_veth_command.stderr | default(''))" - name: set interface up - become: true + become: yes command: ip link set up dev air02 # This makes task never report to be changed, it is a workaround # because if device is already up there is no command output or different RC changed_when: false - name: set interface up - become: true + become: yes command: ip link set up dev air01 # This makes task never report to be changed, it is a workaround # because if device is already up there is no command output or different RC @@ -121,7 +121,7 @@ already_in_bridge: device air02 is already a member of a bridge; can't enslave it to bridge oob-net. - name: Add interface to libvirt managed linux bridge with dhcp - become: true + become: yes command: brctl addif oob-net air02 changed_when: - add_if_command.rc != 1 @@ -132,7 +132,7 @@ register: add_if_command - name: send dhcp request over the interface - become: true + become: yes command: timeout 20s dhclient air01 changed_when: false