[validate-upgrade] use 'become' instead of 'sudo'

- This patch avoids deprecations warning about using sudo/sudo_user
  instead of become/become_user.
- Adds new line at the end of roles/../handlers/main.yaml file.

Change-Id: Ia13d3f4b723de5d917cc48b4870425e2f7548e1b
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
changes/01/409801/2
Gael Chamoulaud 6 years ago
parent cffed80ccc
commit ab0e550d7a

@ -46,7 +46,7 @@ Example Playbook
- name: Upgrade overcloud
hosts: undercloud
gather_facts: no
sudo: yes
become: yes
roles:
- ansible-role-tripleo-overcloud-upgrade
```

@ -2,7 +2,7 @@
# handlers file for upgrade
- name: restart openstack services
service: name={{item}} state=restarted
sudo: yes
become: yes
with_items:
- openstack-heat-api
- openstack-heat-engine
@ -10,7 +10,7 @@
- name: create vlan if doesn't exist
ignore_errors: yes
sudo: yes
become: yes
shell: >
ifconfig {{ network_isolation_vlan }};
if [[ $? != 0 ]]; then \
@ -21,14 +21,15 @@
- name: set vlan up
ignore_errors: yes
sudo: yes
become: yes
shell: >
ip l set dev {{ network_isolation_vlan }} up; ip addr add {{ network_isolation_ipv4_cidr }} dev {{ network_isolation_vlan }};
when: network_isolation
- name: allow traffic for the controller
sudo: yes
become: yes
shell: >
sudo iptables -A BOOTSTACK_MASQ -s {{ network_isolation_ipv4_cidr }} ! \
-d {{ network_isolation_ipv4_cidr }} -j MASQUERADE -t nat
when: network_isolation
when: network_isolation

@ -23,13 +23,13 @@
- name: Add the no ssh finger print checking into upgrade-non-controller.sh
when: step_upgrade_undercloud
sudo: yes
become: yes
shell: >
sed -i 's/ssh/ssh -o StrictHostKeyChecking=no/' \
{{ upgrade_non_controller_script }}
- name: allow traffic for the controller
sudo: yes
become: yes
shell: >
sudo iptables -A BOOTSTACK_MASQ -s {{ network_isolation_ipv4_cidr }} ! \
-d {{ network_isolation_ipv4_cidr }} -j MASQUERADE -t nat;
@ -68,7 +68,7 @@
# TODO: remove this with a smarter fix
- name: Set the num of heat workers
when: set_heat_workers
sudo: yes
become: yes
shell: >
sed -i "/#num_engine_workers/a num_engine_workers = 6" /etc/heat/heat.conf;
sed -i "s/num_engine_workers.*$/num_engine_workers = 6/" /etc/heat/heat.conf;
@ -82,7 +82,7 @@
- name: fix grep to upgrade-non-controller.sh
when: major_upgrade|bool and target_upgrade_version == 'master'
sudo: yes
become: yes
shell: >
sudo sed -i 's/nova show \$name_or_id | grep status /nova show \$name_or_id | grep -w status /' /bin/upgrade-non-controller.sh;

@ -1,6 +1,6 @@
---
- name: Clean up the repos
sudo: yes
become: yes
file: path=/etc/yum.repos.d/{{ item }} state=absent
with_items: "{{ repos }}"
when: step_pre_undercloud_upgrade
@ -12,13 +12,13 @@
mode: 0744
- name: Execute upgrade repo script
sudo: yes
become: yes
shell: |
{{ upgrade_working_dir }}/upgrade-undercloud-repo.sh > upgrade-undercloud-repo.sh.log 2>&1
when: step_pre_undercloud_upgrade
- name: Clean yum cache
sudo: yes
become: yes
shell: yum clean all
- name: Push hieradata override file for workers

@ -8,7 +8,7 @@
- name: create vlan if doesn't exist
ignore_errors: yes
sudo: yes
become: yes
shell: >
ifconfig {{ network_isolation_vlan }};
if [[ $? != 0 ]]; then \
@ -19,7 +19,7 @@
- name: set vlan up
ignore_errors: yes
sudo: yes
become: yes
shell: >
ip l set dev {{ network_isolation_vlan }} up; ip addr add {{ network_isolation_ipv4_cidr }} dev {{ network_isolation_vlan }};
when: network_isolation|bool and deployment_type == "virtual"

@ -1,6 +1,6 @@
- name: Set undercloud repo
hosts: undercloud
gather_facts: no
sudo: yes
become: yes
roles:
- { role: ansible-role-tripleo-overcloud-upgrade, tags: ['upgrade-repo'] }

Loading…
Cancel
Save