Ansible new project
This is my checklist of what to include when starting a new project.
This is a rought outline, and it should be put in a .tar.gz for quick startup.
- 
    Create the inventory file e.g. echo newserver >> inventory
- 
    Create the ansible.cfgfile.Content is something like this [defaults] inventory = inventory roles_path = ./roles-ext:./roles pipelining = True
- 
    Create a role_req.ymlfor dependenciesContent is comething like #- src: git+https://gitlab.com/<somerepo> # name: server-someserverSee galaxy docs for syntax I intentionaly do not call it requirements.ymlto avoid any python confusion.
- 
    Create the roles directory for external roles mkdir roles_ext
- 
    Fetch roles using ansible-galaxy install -r role_req.yml -p roles-ext(if you added any)
- 
    Add an initial generic playbook.ymlContent is comething like - hosts: all become: true task: - name: say hi debug: msg="hi"
- 
    Spin up server, reset passwords and such 
- 
    Add group vars and host_vars passwords fileI follow [my own suggestion]/ansible-user/. 
- 
    Ensure you have ssh access to the server ssh user@newserver
- 
    Run the playbook ansible-playbook playbook.ymlcheck that it works 
- 
    Add the gitlab-ci part See [the post about that]/Ansible/. 
- 
    Do git init
- 
    create .gitignorewith the following entriesvault-password roles_ext
- 
    Create a vault password file and put it in vault-password
- 
    Encrypt the password files ansible-vault encrypt --vault-password-file vault-password host_vars/*/passwords.yml
- 
    Add the lot to git git add .andgit commit -m "first commit"