SturmB icon

digitalocean.yml

SturmB | PRO | 06/09/20 03:07:03 PM UTC | 0 ⭐ | 286 👁️ | Never ⏰ | []
YAML |

1.19 KB

|

None

|

0 👍

/

0 👎

---
- hosts: do
  remote_user: root
  gather_facts: false
 
  vars_files:
    - vars.yml
 
  pre_tasks:
    - name: Wait for port 22 to become available
      local_action: "wait_for port=22 host={{ inventory_hostname }}"
    
    - name: Gathering Facts
      setup:

  tasks:
    - name: Ensure user is created
      include_role:
        name: weareinteractive.users
 
    - name: Ensure git is installed
      import_role:
        name: geerlingguy.git
 
    - name: Ensure zsh and all plugins are installed
      include_role:
        name: viasite-ansible.zsh
 
    - name: Ensure Ruby and gems are installed
      include_role:
        name: geerlingguy.ruby
 
- hosts: do
  remote_user: "{{ new_user }}"
  gather_facts: false
 
  vars_files:
    - vars.yml
 
  tasks:
    - name: Ensure SSH key pair is created
      openssh_keypair:
        path: ~/.ssh/id_github
        state: present
        type: "ed25519"
        comment: "test@digitalocean"
      register: keys
 
    - name: Ensure SSH key is on GitHub
      github_key:
        name: "test@digitalocean"
        token: "{{ github_access_token }}"
        state: present
        pubkey: "{{ keys.public_key }}"

Comments