ansible_galaxy
Differences
This shows you the differences between two versions of the page.
| ansible_galaxy [2025/07/26 17:09] – - Imported by DokuWiki Advanced Plugin wikiadm | ansible_galaxy [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Comandos essenciais do Ansible Galaxy ====== | ||
| - | <file bash> | ||
| - | $ cd / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role --help | ||
| - | usage: ansible-galaxy role [-h] ROLE_ACTION ... | ||
| - | |||
| - | positional arguments: | ||
| - | ROLE_ACTION | ||
| - | init | ||
| - | remove | ||
| - | delete | ||
| - | list Show the name and version of each role installed in the roles_path. | ||
| - | search | ||
| - | import | ||
| - | setup Manage the integration between Galaxy and the given source. | ||
| - | info View more details about a specific role. | ||
| - | install | ||
| - | |||
| - | options: | ||
| - | -h, --help | ||
| - | </ | ||
| - | |||
| - | Principais subcomandos: | ||
| - | * **init:** Inicializa um nova Role; | ||
| - | * **remove:** Exclui uma Role de roles_path; | ||
| - | * **delete:** Remove a Role do Ansible Galaxy(não remove ou altera o repositório real do GitHub); | ||
| - | * **list:** Lista as Roles instaladas no roles_path; | ||
| - | * **search:** Pesquisa uma Role no banco de dados do Ansible Galaxy por tags, plataformas, | ||
| - | * **import:** Importa uma Role para um servidor galaxy; | ||
| - | * **setup:** Gerencia a integração entre o Ansible Galaxy e a fonte fornecida; | ||
| - | * **info:** Exibe detalhes sobre uma Role específica; | ||
| - | * **install: | ||
| - | |||
| - | ==== Listar e pesquisar Roles ==== | ||
| - | Para listar as Roles disponíveis no sistema, execute o subcomando '' | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role list | ||
| - | # / | ||
| - | </ | ||
| - | |||
| - | Para pesquisar uma determinada Role disponível no Ansible Galaxy, execute o subcomando '' | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role search ntpdate | ||
| - | |||
| - | Found 18 roles matching your search: | ||
| - | |||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | |||
| - | Para pesquisar uma determinada Role a partir de um autor, use a flag '' | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role search --author geerlingguy | ||
| - | |||
| - | Found 101 roles matching your search: | ||
| - | |||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | [...] | ||
| - | </ | ||
| - | |||
| - | Para pesquisar uma determinada Role a partir de um autor e uma tag, use as flags '' | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role search --author geerlingguy --galaxy-tags ntp | ||
| - | |||
| - | Found 1 roles matching your search: | ||
| - | |||
| - | | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | |||
| - | ==== Exibir informações e instalar Roles ==== | ||
| - | |||
| - | Para exibir informações sobre uma Role disponível no Ansible Galaxy, execute o subcomando '' | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role info geerlingguy.ntp | ||
| - | |||
| - | Role: geerlingguy.ntp | ||
| - | description: | ||
| - | active: True | ||
| - | commit: d9bc078d9972f0d28ab2301fb36783a12a10ee13 | ||
| - | commit_message: | ||
| - | |||
| - | Fixes service not found issue. | ||
| - | commit_url: https:// | ||
| - | company: Midwestern Mac, LLC | ||
| - | created: 2014-03-05T15: | ||
| - | download_count: | ||
| - | forks_count: | ||
| - | github_branch: | ||
| - | github_repo: | ||
| - | github_user: | ||
| - | id: 464 | ||
| - | imported: 2022-01-19T10: | ||
| - | is_valid: True | ||
| - | issue_tracker_url: | ||
| - | license: license (BSD, MIT) | ||
| - | min_ansible_version: | ||
| - | modified: 2022-01-19T15: | ||
| - | open_issues_count: | ||
| - | path: ('/ | ||
| - | role_type: ANS | ||
| - | stargazers_count: | ||
| - | travis_status_url: | ||
| - | </ | ||
| - | |||
| - | Para instalar uma Role disponível no Ansible Galaxy, execute o subcomando '' | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role install geerlingguy.ntp | ||
| - | Starting galaxy role install process | ||
| - | - downloading role ' | ||
| - | - downloading role from https:// | ||
| - | - extracting geerlingguy.ntp to / | ||
| - | - geerlingguy.ntp (2.3.1) was installed successfully | ||
| - | </ | ||
| - | |||
| - | Verifique que agora possuímos uma nova Role: | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role list | ||
| - | # / | ||
| - | - geerlingguy.ntp, | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ tree / | ||
| - | / | ||
| - | ├── LICENSE | ||
| - | ├── README.md | ||
| - | ├── defaults | ||
| - | │ └── main.yml | ||
| - | ├── handlers | ||
| - | │ └── main.yml | ||
| - | ├── meta | ||
| - | │ └── main.yml | ||
| - | ├── molecule | ||
| - | │ └── default | ||
| - | │ | ||
| - | │ | ||
| - | ├── tasks | ||
| - | │ └── main.yml | ||
| - | ├── templates | ||
| - | │ ├── chrony.conf.j2 | ||
| - | │ ├── clock.j2 | ||
| - | │ └── ntp.conf.j2 | ||
| - | └── vars | ||
| - | ├── Archlinux.yml | ||
| - | ├── Debian.yml | ||
| - | ├── FreeBSD.yml | ||
| - | ├── RedHat.yml | ||
| - | └── Suse.yml | ||
| - | |||
| - | 8 directories, | ||
| - | </ | ||
| - | ===== Aplicar configurações e remover uma Role ===== | ||
| - | Para finalizar, é preciso criar um arquivo responsável em carregar a Role e definir em qual máquina ela será aplicada. | ||
| - | <file bash> | ||
| - | $ cat ~/ | ||
| - | --- | ||
| - | - hosts: local | ||
| - | roles: | ||
| - | - geerlingguy.ntp | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible-playbook --syntax-check ~/ | ||
| - | |||
| - | playbook: / | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible-playbook ~/ | ||
| - | |||
| - | PLAY [local] **************************************************************************************************************************************************************************************************** | ||
| - | TASK [Gathering Facts] ****************************************************************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Include OS-specific variables.] ********************************************************************************************************************************************************* | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Set the ntp_driftfile variable.] ******************************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Set the ntp_package variable.] ********************************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Set the ntp_config_file variable.] ****************************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Set the ntp_daemon variable.] *********************************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Ensure NTP package is installed.] ******************************************************************************************************************************************************* | ||
| - | changed: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Ensure tzdata package is installed (Linux).] ******************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Set timezone.] ************************************************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Populate service facts.] **************************************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Disable systemd-timesyncd if it's running but ntp is enabled.] ************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Ensure NTP is running and enabled as configured.] *************************************************************************************************************************************** | ||
| - | ok: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Ensure NTP is stopped and disabled as configured.] ************************************************************************************************************************************** | ||
| - | skipping: [ansible-server] | ||
| - | |||
| - | TASK [geerlingguy.ntp : Generate ntp configuration file.] ******************************************************************************************************************************************************* | ||
| - | skipping: [ansible-server] | ||
| - | |||
| - | PLAY RECAP ****************************************************************************************************************************************************************************************************** | ||
| - | ansible-server | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible local -m shell -a 'ntpq -p' | ||
| - | ansible-server | CHANGED | rc=0 >> | ||
| - | | ||
| - | ============================================================================== | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | +ec2-52-67-171-2 23.254.215.107 | ||
| - | +ec2-54-232-82-2 200.160.7.197 | ||
| - | +ns1.nvsul.com.b 200.160.7.197 | ||
| - | +b.ntp.br | ||
| - | # | ||
| - | +a.ntp.br | ||
| - | +rockstor.vbd.op 129.134.28.123 | ||
| - | +lrtest2.ntp.ifs 143.107.229.211 | ||
| - | +b.st1.ntp.br | ||
| - | *a.st1.ntp.br | ||
| - | +138-36-164-35.o 200.160.7.197 | ||
| - | +66.90.70.34 | ||
| - | | ||
| - | | ||
| - | | ||
| - | | ||
| - | </ | ||
| - | |||
| - | Para remover uma Role disponível no sistema, execute o subcomando '' | ||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role remove geerlingguy.ntp | ||
| - | - successfully removed geerlingguy.ntp | ||
| - | </ | ||
| - | |||
| - | <file bash> | ||
| - | $ sudo ansible-galaxy role list | ||
| - | # / | ||
| - | </ | ||
ansible_galaxy.1753560543.txt.gz · Last modified: by wikiadm
