Browse Source

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
master
Sorin Sbarnea 4 months ago
parent
commit
4100be27be
1 changed files with 9 additions and 9 deletions
  1. 9
    9
      devstack-vm-gate.sh

+ 9
- 9
devstack-vm-gate.sh View File

@@ -78,15 +78,15 @@ function setup_ssh {
78 78
     # node and all of the subnodes.
79 79
     local path=$1
80 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 82
         -a "path='$path' mode=0700 state=directory"
83 83
     # Note that we append to the authorized keys file just in case something
84 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 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 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 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 212
         ssh-keyscan $HOSTNAME >> /tmp/tmp_ssh_known_hosts
213 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 216
             -a "src=/tmp/tmp_ssh_known_hosts dest=/etc/ssh/ssh_known_hosts mode=0444"
217 217
 
218 218
     for NODE in $sub_nodes; do
@@ -654,10 +654,10 @@ function setup_localrc {
654 654
 function setup_access_for_stack_user {
655 655
     # Make the workspace owned by the stack user
656 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 658
         -a "chown -R stack:stack '$BASE'"
659 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 661
         -a "chmod 777 '$WORKSPACE/logs'"
662 662
 }
663 663
 
@@ -754,9 +754,9 @@ else
754 754
     if [ -d "$BASE/data/CA" ] && [ -f "$BASE/data/ca-bundle.pem" ] ; then
755 755
         # Sync any data files which include certificates to be used if
756 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 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 760
             -a "path='$BASE/data/CA' state=directory owner=stack group=stack mode=0755"
761 761
         $ANSIBLE subnodes -f 5 -i "$WORKSPACE/inventory" \
762 762
             --sudo -m synchronize \

Loading…
Cancel
Save