tech:ansible_awx_-_tower_cli
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:ansible_awx_-_tower_cli [2025/12/03 10:33] – Jean-Baptiste | tech:ansible_awx_-_tower_cli [2026/06/09 17:44] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Ansible AWX - Tower Cli | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * [awxkit](https:// | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | pip3 install awxkit | ||
| + | |||
| + | export AWXKIT_API_BASE_PATH=/ | ||
| + | |||
| + | awx --help | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Connexion | ||
| + | ~~~bash | ||
| + | export TOWER_HOST=https:// | ||
| + | export TOWER_USERNAME=jean | ||
| + | export TOWER_VERIFY_SSL=false | ||
| + | read -s TOWER_PASSWORD | ||
| + | #awx login --conf.host " | ||
| + | awx login | ||
| + | awx ping | jq | ||
| + | ~~~ | ||
| + | |||
| + | Export | ||
| + | ~~~bash | ||
| + | # awx --conf.host $TOWER_HOST --conf.token " | ||
| + | # awx --conf.host $TOWER_HOST --conf.token " | ||
| + | |||
| + | awx export --job_templates 42 | ||
| + | awx export --job_template " | ||
| + | awx export --credentials " | ||
| + | |||
| + | |||
| + | # Exemple avec : http:// | ||
| + | awx export --inventory 4 | ||
| + | # Il ne faut pas le numero de l' | ||
| + | awx export --inventory_source 15 | ||
| + | |||
| + | awx -f yaml export > all.yaml | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | Vérif | ||
| + | ~~~bash | ||
| + | for fic in tpl_*.json* ; do awx export --job_templates "$(cat $fic | jq -r ' | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Import | ||
| + | ~~~bash | ||
| + | export TOWER_HOST=https:// | ||
| + | awx login | ||
| + | awx import -v < tpl_388.json 2> | ||
| + | awx import < credentials_IOPS_GIT.json | ||
| + | awx import < tpl_388.json | ||
| + | ~~~ | ||
| + | |||
| + | Autres commandes | ||
| + | ~~~bash | ||
| + | awx jobs list --controller_node " | ||
| + | awx job_templates get 176 | ||
| + | |||
| + | awx job list -f human | ||
| + | awx jobs list --all -f human --filter ' | ||
| + | awx job stdout 6 | ||
| + | ~~~ | ||
| + | |||
| + | -------------------------------------- | ||
| + | |||
| + | |||
| + | Alternatives à Ansible Tower / APP : | ||
| + | * [[Notes Ansible SemaphoreUI]] | ||
| + | * [Polemarch](https:// | ||
| + | * [Rundeck + Ansible](https:// | ||
| + | * Gitlab-CI | ||
| + | |||
| + | Voir aussi | ||
| + | * [Squest](https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | `tower-job.sh` | ||
| + | ~~~bash | ||
| + | #!/bin/bash | ||
| + | |||
| + | # tower-job | ||
| + | # https:// | ||
| + | |||
| + | # Variables | ||
| + | tower_template_id=574 | ||
| + | |||
| + | # Directions | ||
| + | # | ||
| + | # install tower-cli | ||
| + | # sudo pip install tower-cli | ||
| + | # | ||
| + | # put this file in a root of your project | ||
| + | # {{ project_root }}/ | ||
| + | # | ||
| + | # create a file ~/ | ||
| + | # | ||
| + | # | ||
| + | # host = fqdn.yourhost.com | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # add variables from your tower survey to a vars file. we'll use group_vars/ | ||
| + | # --- | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # define your job template ID # in variables above | ||
| + | # | ||
| + | # | ||
| + | # make this file executable | ||
| + | # chmod 755 tower-job | ||
| + | # | ||
| + | # then run it | ||
| + | # | ||
| + | |||
| + | set -e | ||
| + | |||
| + | if [ ! -d ' | ||
| + | echo "No group_vars found, run this out of root of project"; | ||
| + | fi | ||
| + | |||
| + | tower-cli job launch --job-template=$tower_template_id --extra-vars=" | ||
| + | job_id=$(cat tower-job.pid | tail -n2 | head -n1 | awk ' | ||
| + | rm tower-job.pid | ||
| + | while [ $(tower-cli job list --status=running | grep $job_id | wc -l) -lt ' | ||
| + | echo -n " | ||
| + | done; | ||
| + | |||
| + | tower-cli job monitor $job_id | ||
| + | |||
| + | exit 0 | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | https:// | ||
| + | |||
| + | Voir aussi : | ||
| + | * http:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ## API Tower / AWS | ||
| + | |||
| + | API Tower | ||
| + | |||
| + | pip install ansible-tower-cli | ||
| + | https:// | ||
| + | https:// | ||
| + | |||
| + | tower-cli job launch --job-template=4 -v | ||
| + | |||
| + | AWX CLI | ||
| + | https:// | ||
| + | |||
| + | tower-cli job launch --job-template=666 --extra-vars=" | ||
| + | |||
| + | |||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | Ansible Tower API Guide | ||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ## Access Control - RBAC | ||
| + | |||
| + | |||
| + | Authentification | ||
| + | Controle d' | ||
| + | Imputabilité (Accoutability) | ||
| + | Tracabilité (Traceability) | ||
| + | Disponibilité (Availability) | ||
| + | Confidentialité (Confidentiality) | ||
| + | |||
| + | Habilitation : | ||
| + | [Vidéo - Infuser du métier dans les autorisations avec ReBAC (Geoffroy BRAUN et Pauline JAMIN)](https:// | ||
| + | |||
| + | RBAC : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | Voir : | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | Execute Role | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | |||
| + | https:// | ||
| + | |||
| + | How Can I Map Organizations and Teams with LDAP in Ansible Tower? | ||
| + | * https:// | ||
| + | |||
| + | Ansible Tower Teams | ||
| + | Teams provide a means to implement role-based access control schemes and delegate responsibilities across organizations. | ||
| + | |||
| + | ---------------- | ||
| + | |||
| + | ~~~bash | ||
| + | tower-cli workflow_job list -W 2389 --status running | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | |||
