summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Göhler <github@ghlr.de>2024-05-06 21:27:21 +0200
committerGitHub <noreply@github.com>2024-05-06 21:27:21 +0200
commit39a997dd95282c09d5f78478998d6c8be57e0ca3 (patch)
tree25294dc51c058580c869e518d845ae3830ae2c08
parent2ceaae52ec946bddfc36fe43d3d94f12a4304f0f (diff)
parenta60de82f58745375b697f190c02135fea433bd76 (diff)
downloadvyos-documentation-39a997dd95282c09d5f78478998d6c8be57e0ca3.tar.gz
vyos-documentation-39a997dd95282c09d5f78478998d6c8be57e0ca3.zip
Merge pull request #1413 from patkarcarasent/patch-1
Update cloud-init.rst (added additional info on the need to run scripts as vyattacfg group)
-rw-r--r--docs/automation/cloud-init.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/automation/cloud-init.rst b/docs/automation/cloud-init.rst
index bbc8967c..20b6dc49 100644
--- a/docs/automation/cloud-init.rst
+++ b/docs/automation/cloud-init.rst
@@ -156,6 +156,12 @@ can execute commands and then configure VyOS in the same script.
The following example sets the hostname based on the instance identifier
obtained from the EC2 metadata service.
+Please observe that the same configuration pitfall described in :ref:`command-scripting`
+exists here when running ``configure`` in any context as without user group
+'vyattacfg' will cause the error message ``Set failed`` to appear.
+We therefore need to wrap it and have the script re-execute itself with the correct
+group permissions.
+
.. code-block:: yaml
@@ -166,6 +172,9 @@ obtained from the EC2 metadata service.
permissions: '0775'
content: |
#!/bin/vbash
+ if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+ fi
source /opt/vyatta/etc/functions/script-template
hostname=`curl -s http://169.254.169.254/latest/meta-data/instance-id`
configure