Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: Specify ansible_user var for local playbook run #5955

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions utils/ansible/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ ansible-playbook -i $TARGET_IP, configure-self-hosted-runner.yml --extra-vars

# Provisioning from the target platform itself
It is possible to run playbooks directly on the target platform.
In this case, you have to always pass `ansible_user=pmdkuser` as an additional
variable since the playbooks are fine-tuned for remote execution and assume
the `ansible_user` variable is defined. When running on a remote target the
connection plugin does it for you.

To run playbooks inside the platform please comment out the line:
```
- hosts: "{{ host }}"
Expand All @@ -123,18 +128,18 @@ uncomment the following two:
and run commands as follows e.g.
```sh
export SETUP_SCRIPT= # opensuse-setup.yml or rockylinux-setup.yml
sudo ansible-playbook $SETUP_SCRIPT --extra-vars "testUser=pmdkuser"
sudo ansible-playbook $SETUP_SCRIPT --extra-vars "ansible_user=pmdkuser"
```
**Note**: If a reboot is necessary, as described above, perform it manually and
rerun the playbook without in question.

And next log in as `pmdkuser`:
```sh
ansible-playbook configure-pmem.yml --extra-vars "newRegions=true"
ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser newRegions=true"
# you will have to perform a reboot manually
sudo reboot
# and re-run the playbook without newRegions=true to finalize the setup
ansible-playbook configure-pmem.yml
ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser"
```

# Example - GitHub self-hosted runner setup
Expand Down Expand Up @@ -167,19 +172,19 @@ Log in as `pmdkuser` and execute:
```sh
# as pmdkuser
cd pmdk/utils/ansible
ansible-playbook configure-pmem.yml --extra-vars "newRegions=true"
ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser newRegions=true"
sudo reboot
# ...
cd pmdk/utils/ansible
# note - no newRegions=true when running the playbook after the reboot
ansible-playbook configure-pmem.yml
ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser"

export GHA_TOKEN= # GitHub token generated for a new self-hosted runner
export HOST_NAME=`hostname`
export LABELS=rhel
export VARS_GHA=http_proxy=http://proxy-dmz.{XXX}.com:911,https_proxy=http://proxy-dmz.{XXX}.com:912
ansible-playbook configure-self-hosted-runner.yml -extra-vars \
"runner_name=$HOST_NAME labels=$LABELS token=$GHA_TOKEN vars_gha=$VARS_GHA"
"ansible_user=pmdkuser runner_name=$HOST_NAME labels=$LABELS token=$GHA_TOKEN vars_gha=$VARS_GHA"
cd
rm -rf pmdk
```
Expand Down Expand Up @@ -207,19 +212,19 @@ Log in as `pmdkuser` and execute:
```sh
# as pmdkuser:
cd pmdk/utils/ansible
ansible-playbook configure-pmem.yml --extra-vars "newRegions=true"
ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser newRegions=true"
sudo reboot
# ...
cd pmdk/utils/ansible
# note - no newRegions=true when running the playbook after the reboot
ansible-playbook configure-pmem.yml
ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser"

export GHA_TOKEN= # GitHub token generated for a new self-hosted runner
export HOST_NAME=`hostname`
export LABELS=opensuse
export VARS_GHA=http_proxy=http://proxy-dmz.{XXX}.com:911,https_proxy=http://proxy-dmz.{XXX}.com:912
ansible-playbook configure-self-hosted-runner.yml -extra-vars \
"runner_name=$HOST_NAME labels=$LABELS token=$GHA_TOKEN vars_gha=$VARS_GHA"
"ansible_user=pmdkuser runner_name=$HOST_NAME labels=$LABELS token=$GHA_TOKEN vars_gha=$VARS_GHA"
cd
rm -rf pmdk
```
4 changes: 2 additions & 2 deletions utils/ansible/configure-pmem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
# - hosts: localhost
# connection: local
# c) setup PMem for the first time (establish regions):
# ansible-playbook configure-pmem.yml --extra-vars "newRegions=true"
# ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser newRegions=true"
# d) setup PMem if it already has been initialized before:
# ansible-playbook configure-pmem.yml
# ansible-playbook configure-pmem.yml --extra-vars "ansible_user=pmdkuser"
#

- hosts: "{{ host }}"
Expand Down
2 changes: 1 addition & 1 deletion utils/ansible/configure-self-hosted-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# export LABELS= # rhel or opensuse
# export VARS_GHA=http_proxy=http://proxy-dmz.{XXX}.com:911,https_proxy=http://proxy-dmz.{XXX}.com:912
# ansible-playbook configure-self-hosted-runner.yml --extra-vars \
# "runner_name=$HOST_NAME labels=$LABELS vars_gha=$VARS_GHA token=$GHA_TOKEN"
# "ansible_user=pmdkuser runner_name=$HOST_NAME labels=$LABELS vars_gha=$VARS_GHA token=$GHA_TOKEN"
#

#
Expand Down
Loading