diff --git a/README.md b/README.md index 16c3549..c1b1f98 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,12 @@ Algo (short for "Al Gore", the **V**ice **P**resident of **N**etworks everywhere ### Initial Deployment -To install the dependencies on OS X: +To install the dependencies on OS X or Linux: ``` sudo easy_install pip sudo pip install ansible dopy==0.3.5 +sudo pip install boto ``` There are two available cloud providers: @@ -59,17 +60,12 @@ When the process is done, you can find `.mobileconfig` files and certificates in ### User Management -When the deploy proccess is done a new server will be placed in the local inventory file `inventory_users`. If you want to add or delete users, update the `users` list in `config.cfg` and run the playbook `users.yml`. This command will update users on any servers in the file `inventory_users`. +If you want to add or delete users, update the `users` list in `config.cfg` and run the command: ``` -ansible-playbook users.yml --user=root -i inventory_users +./run users ``` -Note: For EC2 users, Algo does NOT use EC2 dynamic inventory for user management. Please continue to use users.yml playbook as described below. This may be subject to change in the future. - -``` -ansible-playbook users.yml --user=ubuntu -i inventory_users -``` ## FAQ diff --git a/digitalocean.yml b/digitalocean.yml index c83f961..51bf1f2 100644 --- a/digitalocean.yml +++ b/digitalocean.yml @@ -108,6 +108,7 @@ - name: Wait for SSH to become available local_action: "wait_for port=22 host={{ inventory_hostname }} timeout=320" + become: false roles: - common diff --git a/inventory_users b/inventory_users deleted file mode 100644 index 1c4194e..0000000 --- a/inventory_users +++ /dev/null @@ -1,2 +0,0 @@ -[user-management] -52.59.88.212 diff --git a/non-cloud.yml b/non-cloud.yml index be31f0a..19a9c77 100644 --- a/non-cloud.yml +++ b/non-cloud.yml @@ -9,7 +9,7 @@ private: no - name: "server_user" - prompt: "What user should we use?:\n" + prompt: "What user should we use to login on the server?:\n" default: "root" private: no diff --git a/roles/vpn/tasks/main.yml b/roles/vpn/tasks/main.yml index 478c437..c1bf4f8 100644 --- a/roles/vpn/tasks/main.yml +++ b/roles/vpn/tasks/main.yml @@ -136,9 +136,5 @@ - name: Fetch server CA certificate fetch: src=/{{ easyrsa_dir }}/easyrsa3/pki/ca.crt dest=configs/{{ server_name }}_ca.crt flat=yes - -- name: Add server to the inventory file - local_action: lineinfile dest=inventory_users line="{{ inventory_hostname }}" insertafter='\[user-management\]\n' state=present - become: false notify: - congrats diff --git a/run b/run index 00482d4..5283717 100755 --- a/run +++ b/run @@ -1,21 +1,35 @@ #!/bin/sh -echo -n " -What provider would you like to use? - 1. DigitalOcean - 2. Amazon EC2 - 3. Local installation (non-cloud or a server already deployed) - -Enter the number of your desired provider -: " +algo_provisioning () { + echo -n " + What provider would you like to use? + 1. DigitalOcean + 2. Amazon EC2 + 3. Local installation (non-cloud or a server already deployed) + + Enter the number of your desired provider + : " + + read N + + case "$N" in + 1) CLOUD="digitalocean" ;; + 2) CLOUD="ec2" ;; + 3) CLOUD="non-cloud" ;; + *) exit 1 ;; + esac + + ansible-playbook deploy.yml -e "provider=${CLOUD}" +} + +user_management () { + ansible-playbook users.yml +} + +case "$1" in + users) user_management ;; + *) algo_provisioning ;; +esac -read N -case "$N" in - 1) CLOUD="digitalocean" ;; - 2) CLOUD="ec2" ;; - 3) CLOUD="non-cloud" ;; - *) exit 1 ;; -esac -ansible-playbook deploy.yml -e "provider=${CLOUD}" diff --git a/users.yml b/users.yml index 893a550..f995cd4 100644 --- a/users.yml +++ b/users.yml @@ -1,7 +1,34 @@ --- +- hosts: localhost + gather_facts: False + vars_files: + - config.cfg + vars_prompt: + + - name: "server_ip" + prompt: "\nEnter IP address of your server:\n" + private: no + + - name: "server_user" + prompt: "What user should we use to login on the server?:\n" + default: "root" + private: no + + tasks: + - name: Add the server to the vpn-host group + add_host: + hostname: "{{ server_ip }}" + groupname: vpn-host + ansible_ssh_user: "{{ server_user }}" + ansible_python_interpreter: "/usr/bin/python2.7" + + - name: Wait for SSH to become available + local_action: "wait_for port=22 host={{ server_ip }} timeout=320" + become: false + - name: User management - hosts: user-management + hosts: vpn-host gather_facts: false become: true vars_files: