SturmB

digitalocean.yml

Jun 9th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.19 KB | None | 0 0
  1. ---
  2. - hosts: do
  3.   remote_user: root
  4.   gather_facts: false
  5.  
  6.   vars_files:
  7.    - vars.yml
  8.  
  9.   pre_tasks:
  10.     - name: Wait for port 22 to become available
  11.       local_action: "wait_for port=22 host={{ inventory_hostname }}"
  12.    
  13.     - name: Gathering Facts
  14.       setup:
  15.   tasks:
  16.     - name: Ensure user is created
  17.       include_role:
  18.         name: weareinteractive.users
  19.  
  20.     - name: Ensure git is installed
  21.       import_role:
  22.         name: geerlingguy.git
  23.  
  24.     - name: Ensure zsh and all plugins are installed
  25.       include_role:
  26.         name: viasite-ansible.zsh
  27.  
  28.     - name: Ensure Ruby and gems are installed
  29.       include_role:
  30.         name: geerlingguy.ruby
  31.  
  32. - hosts: do
  33.   remote_user: "{{ new_user }}"
  34.   gather_facts: false
  35.  
  36.   vars_files:
  37.    - vars.yml
  38.  
  39.   tasks:
  40.     - name: Ensure SSH key pair is created
  41.       openssh_keypair:
  42.         path: ~/.ssh/id_github
  43.         state: present
  44.         type: "ed25519"
  45.         comment: "test@digitalocean"
  46.       register: keys
  47.  
  48.     - name: Ensure SSH key is on GitHub
  49.       github_key:
  50.         name: "test@digitalocean"
  51.         token: "{{ github_access_token }}"
  52.         state: present
  53.         pubkey: "{{ keys.public_key }}"
Add Comment
Please, Sign In to add comment