Migrate playbooks to use 'become'

Ansible is scheduled to remove the 'sudo' module
and replace it with 'become'. Switch to using this
now since it is already supported in 1.9.

Closes-Bug: #1504535

Change-Id: Ie63816e36a95c86d54fea5f50325522b41597047
This commit is contained in:
stephane 2015-10-14 10:58:31 -07:00
parent a693f674f2
commit 1920428599
23 changed files with 35 additions and 35 deletions

View File

@ -2,7 +2,7 @@
- hosts: localhost
connection: local
name: "Remove the master_images folder and deployment kernel/ramdisk for clean redeployments when testing."
sudo: yes
become: yes
gather_facts: yes
tasks:
- file: path=/tftpboot/master_images state=absent

View File

@ -2,11 +2,11 @@
- hosts: localhost
connection: local
name: "Collect facts"
sudo: no
become: no
gather_facts: yes
- hosts: baremetal
name: "Create configuration drive files and deploy machines from inventory"
sudo: no
become: no
connection: local
roles:
- role: bifrost-configdrives-dynamic

View File

@ -2,7 +2,7 @@
- hosts: localhost
connection: local
name: "Provide deprecation notice"
sudo: no
become: no
gather_facts: no
pre_tasks:
- name: "Error"

View File

@ -2,11 +2,11 @@
- hosts: localhost
connection: local
name: "Collect facts"
sudo: no
become: no
gather_facts: yes
- hosts: baremetal
connection: local
name: "Enroll hardware from inventory into Ironic"
sudo: no
become: no
roles:
- role: ironic-enroll-dynamic

View File

@ -2,7 +2,7 @@
- hosts: localhost
connection: local
name: "Provide deprecation notice"
sudo: no
become: no
gather_facts: no
pre_tasks:
- name: "Error"

View File

@ -19,11 +19,11 @@
- hosts: localhost
connection: local
name: "Collect facts"
sudo: no
become: no
gather_facts: yes
- hosts: baremetal
name: "Create configuration drive files and deploy machines from inventory"
sudo: no
become: no
connection: local
roles:
- { role: bifrost-configdrives-dynamic, when: provision_state == "available" and maintenance | bool != true }

View File

@ -2,7 +2,7 @@
- hosts: localhost
name: "Install Ironic on the local host."
connection: local
sudo: yes
become: yes
gather_facts: yes
roles:
- { role: bifrost-prep-for-install, when: skip_install is not defined }

View File

@ -97,7 +97,7 @@ Example Playbook
- hosts: baremetal
connection: local
sudo: no
become: no
roles:
- role: bifrost-configdrives-dynamic

View File

@ -50,14 +50,14 @@
local_action: template src=interfaces.j2 dest={{ variable_configdrive_location.stdout }}/{{ uuid }}/openstack/content/0000
when: write_interfaces_file | bool
- name: "Make config drive files"
sudo: yes
become: yes
local_action: command mkisofs -R -V config-2 -o {{http_boot_folder}}/configdrive-{{ uuid }}.iso {{ variable_configdrive_location.stdout }}/{{ uuid }}
- name: "Make config drive files base64 encoded and gzip compressed"
sudo: yes
become: yes
local_action: shell gzip -c {{http_boot_folder}}/configdrive-{{ uuid }}.iso | base64 > {{http_boot_folder}}/configdrive-{{ uuid }}.iso.gz
- name: "Cleanup configdrive .iso files"
sudo: yes
become: yes
local_action: file state=absent name={{http_boot_folder}}/configdrive-{{ uuid }}.iso
- name: "Cleanup configdrive temp folder"
sudo: yes
become: yes
local_action: file state=absent force=yes name={{ variable_configdrive_location.stdout }}

View File

@ -35,7 +35,7 @@ Example Playbook
- hosts: localhost
connection: local
name: "Create bootable image"
sudo: yes
become: yes
gather_facts: yes
roles:
- role: bifrost-create-bootable-image

View File

@ -84,7 +84,7 @@ Example Playbook
- hosts: localhost
connection: local
name: "Build DIB image"
sudo: yes
become: yes
gather_facts: yes
roles:
- role: bifrost-create-dib-image

View File

@ -34,7 +34,7 @@ Example Playbook
- hosts: localhost
connection: local
sudo: yes
become: yes
gather_facts: yes
roles:
- role: bifrost-create-vm-nodes

View File

@ -71,7 +71,7 @@ NOTE: The example below assumes bifrost's default and that an instance_info
- hosts: baremetal
connection: local
sudo: no
become: no
roles:
- role: bifrost-configdrives
- role: bifrost-deploy-nodes-dynamic

View File

@ -136,7 +136,7 @@ Example Playbook
- hosts: localhost
connection: local
name: "Install ironic locally"
sudo: yes
become: yes
gather_facts: yes
roles:
- role: bifrost-ironic-install

View File

@ -48,7 +48,7 @@ of the logic to properly handle an OpenStack CI environment node.
- hosts: localhost
connection: local
name: "Prepare for installation"
sudo: no
become: no
gather_facts: yes
pre_tasks:
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"

View File

@ -65,7 +65,7 @@ Example Playbook
- hosts: localhost
connection: local
name: "Install Ironic"
sudo: yes
become: yes
gather_facts: yes
roles:
- { role: bifrost-prep-for-install, when: skip_install is not defined }

View File

@ -35,7 +35,7 @@ Example Playbook
- hosts: baremetal
connection: local
name: "Adds and removes a .ssh/known_hosts entry"
sudo: no
become: no
gather_facts: no
roles:
- role: bifrost-prepare-for-test-dynamic

View File

@ -25,7 +25,7 @@ Example Playbook
hosts: testvm
name: "Tests connectivity to the VM"
sudo: no
become: no
gather_facts: yes
remote_user: root
roles:

View File

@ -31,7 +31,7 @@ Example Playbook
- hosts: baremetal
connection: local
name: "Unprovisions the test node"
sudo: no
become: no
gather_facts: no
roles:
- role: bifrost-unprovision-node-dynamic

View File

@ -36,7 +36,7 @@ Example Playbook
- hosts: baremetal
connection: local
name: "Delete the node"
sudo: no
become: no
gather_facts: no
roles:
- role: ironic-delete-dynamic

View File

@ -3,7 +3,7 @@
- hosts: localhost
connection: local
name: "Executes install, enrollment, and testing in one playbook"
sudo: yes
become: yes
gather_facts: yes
pre_tasks:
- name: "Set default baremetal.csv file if not already defined"

View File

@ -9,7 +9,7 @@
- hosts: localhost
connection: local
name: "Executes install, enrollment, and testing in one playbook"
sudo: no
become: no
gather_facts: yes
pre_tasks:
- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI"
@ -40,7 +40,7 @@
- hosts: localhost
connection: local
name: "Executes install, enrollment, and testing in one playbook"
sudo: yes
become: yes
gather_facts: yes
pre_tasks:
- name: "Collect process list if running in a CI System"
@ -64,13 +64,13 @@
https_proxy: "{{ lookup('env','https_proxy') }}"
- hosts: baremetal
name: "Enroll node with Ironic"
sudo: no
become: no
connection: local
roles:
- role: ironic-enroll-dynamic
- hosts: baremetal
name: "Creat configuration drive files and deploy machines."
sudo: no
become: no
connection: local
roles:
- role: bifrost-configdrives-dynamic
@ -80,7 +80,7 @@
# on the contents of the CSV file.
- hosts: test
name: "Tests connectivity to the VM"
sudo: no
become: no
gather_facts: no
remote_user: "{{ testing_user }}"
roles:
@ -88,7 +88,7 @@
- hosts: baremetal
connection: local
name: "Unprovisions the test node"
sudo: no
become: no
gather_facts: no
roles:
- role: bifrost-unprovision-node-dynamic

View File

@ -3,7 +3,7 @@
#
#
- hosts: bifrost
sudo: yes
become: yes
tasks:
############################################################################
# Install some reqired bits into the vm
@ -56,7 +56,7 @@
removes=/var/run/reboot-required
register: rebooted
- name: Wait for VM Reboot.
sudo: no
become: no
local_action: wait_for
port=22
host="{{guest_ip.stdout}}"