summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSorin Sbarnea <ssbarnea@redhat.com>2019-01-08 15:05:49 +0000
committerSorin Sbarnea <ssbarnea@redhat.com>2019-01-08 15:05:49 +0000
commit4100be27befd3fbca38ad82d95aaacd5a81898f6 (patch)
treed51398e45eb5cc5c283df37903208e3edf7f3c69
parent113a3c6abba5b74ee5302b9f2b818ae0873787e3 (diff)
Replace deprecated ansible --sudo with --become
Solves annoying warnings and prevents code from breaking on newer ansible which dropped --sudo. The sudo command line option has been deprecated in favor of the "become" command line arguments. This feature will be removed in version 2.6. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg. Change-Id: I0ec17d6bd6a1e3ada366c323ad67e864a7f1b5ed
Notes
Notes (review): Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Workflow+1: Clark Boylan <cboylan@sapwetik.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 10 Jan 2019 04:06:32 +0000 Reviewed-on: https://review.openstack.org/629205 Project: openstack-infra/devstack-gate Branch: refs/heads/master
-rwxr-xr-xdevstack-vm-gate.sh18
1 files changed, 9 insertions, 9 deletions
diff --git a/devstack-vm-gate.sh b/devstack-vm-gate.sh
index 939f9b8..4d92d32 100755
--- a/devstack-vm-gate.sh
+++ b/devstack-vm-gate.sh
@@ -78,15 +78,15 @@ function setup_ssh {
78 # node and all of the subnodes. 78 # node and all of the subnodes.
79 local path=$1 79 local path=$1
80 local dest_file=${2:-id_rsa} 80 local dest_file=${2:-id_rsa}
81 $ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m file \ 81 $ANSIBLE all --become -f 5 -i "$WORKSPACE/inventory" -m file \
82 -a "path='$path' mode=0700 state=directory" 82 -a "path='$path' mode=0700 state=directory"
83 # Note that we append to the authorized keys file just in case something 83 # Note that we append to the authorized keys file just in case something
84 # is already authorized to ssh with content in that file. 84 # is already authorized to ssh with content in that file.
85 $ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m lineinfile \ 85 $ANSIBLE all --become -f 5 -i "$WORKSPACE/inventory" -m lineinfile \
86 -a "line={{ lookup('file', '/etc/nodepool/id_rsa.pub') }} dest='$path/authorized_keys' insertafter=EOF create=yes mode=0600" 86 -a "line={{ lookup('file', '/etc/nodepool/id_rsa.pub') }} dest='$path/authorized_keys' insertafter=EOF create=yes mode=0600"
87 $ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m copy \ 87 $ANSIBLE all --become -f 5 -i "$WORKSPACE/inventory" -m copy \
88 -a "src=/etc/nodepool/id_rsa.pub dest='$path/${dest_file}.pub' mode=0600" 88 -a "src=/etc/nodepool/id_rsa.pub dest='$path/${dest_file}.pub' mode=0600"
89 $ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m copy \ 89 $ANSIBLE all --become -f 5 -i "$WORKSPACE/inventory" -m copy \
90 -a "src=/etc/nodepool/id_rsa dest='$path/${dest_file}' mode=0400" 90 -a "src=/etc/nodepool/id_rsa dest='$path/${dest_file}' mode=0400"
91} 91}
92 92
@@ -212,7 +212,7 @@ function setup_multinode_connectivity {
212 ssh-keyscan $HOSTNAME >> /tmp/tmp_ssh_known_hosts 212 ssh-keyscan $HOSTNAME >> /tmp/tmp_ssh_known_hosts
213 done 213 done
214 214
215 $ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m copy \ 215 $ANSIBLE all --become -f 5 -i "$WORKSPACE/inventory" -m copy \
216 -a "src=/tmp/tmp_ssh_known_hosts dest=/etc/ssh/ssh_known_hosts mode=0444" 216 -a "src=/tmp/tmp_ssh_known_hosts dest=/etc/ssh/ssh_known_hosts mode=0444"
217 217
218 for NODE in $sub_nodes; do 218 for NODE in $sub_nodes; do
@@ -654,10 +654,10 @@ function setup_localrc {
654function setup_access_for_stack_user { 654function setup_access_for_stack_user {
655 # Make the workspace owned by the stack user 655 # Make the workspace owned by the stack user
656 # It is not clear if the ansible file module can do this for us 656 # It is not clear if the ansible file module can do this for us
657 $ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m shell \ 657 $ANSIBLE all --become -f 5 -i "$WORKSPACE/inventory" -m shell \
658 -a "chown -R stack:stack '$BASE'" 658 -a "chown -R stack:stack '$BASE'"
659 # allow us to add logs 659 # allow us to add logs
660 $ANSIBLE all --sudo -f 5 -i "$WORKSPACE/inventory" -m shell \ 660 $ANSIBLE all --become -f 5 -i "$WORKSPACE/inventory" -m shell \
661 -a "chmod 777 '$WORKSPACE/logs'" 661 -a "chmod 777 '$WORKSPACE/logs'"
662} 662}
663 663
@@ -754,9 +754,9 @@ else
754 if [ -d "$BASE/data/CA" ] && [ -f "$BASE/data/ca-bundle.pem" ] ; then 754 if [ -d "$BASE/data/CA" ] && [ -f "$BASE/data/ca-bundle.pem" ] ; then
755 # Sync any data files which include certificates to be used if 755 # Sync any data files which include certificates to be used if
756 # TLS is enabled 756 # TLS is enabled
757 $ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" --sudo -m file \ 757 $ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" --become -m file \
758 -a "path='$BASE/data' state=directory owner=stack group=stack mode=0755" 758 -a "path='$BASE/data' state=directory owner=stack group=stack mode=0755"
759 $ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" --sudo -m file \ 759 $ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" --become -m file \
760 -a "path='$BASE/data/CA' state=directory owner=stack group=stack mode=0755" 760 -a "path='$BASE/data/CA' state=directory owner=stack group=stack mode=0755"
761 $ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" \ 761 $ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" \
762 --sudo -m synchronize \ 762 --sudo -m synchronize \