How to automatically install Ansible Galaxy roles?

前端 未结 8 448
借酒劲吻你
借酒劲吻你 2020-12-07 07:50

All my Ansible playbooks/roles are checked in to my git repo.

However, for Ansible Galaxy roles I always have to explicitly download them one by one on every machine

相关标签:
8条回答
  • 2020-12-07 08:45

    If requirements.yml resides in the roles directory of your project, then Tower/AWX installs the roles automatically.

    0 讨论(0)
  • 2020-12-07 08:46

    Here, my requirements are on the role and used in install.yml

    main.yml

     # tasks file for MY_ROLE
    - name: Install requirements
      local_action: command ansible-galaxy install -r {{ role_path }}/requirements.yml -p /etc/ansible/roles
    
    - include_tasks: install.yml 
    
    .  
    ├── playbook.yml  
    ├── inventory  
    ├── roles  
    │    └── My_Role   
    │        ├── tasks  
    │        │   └── main.yml  
    │        │   └── install.yml  
    │        └── requirements.yml
    
    0 讨论(0)
提交回复
热议问题