Chesters-MacBook-Pro:ControlNode chesterdias$ ansible-playbook --ask-vault-pass control_node.yml Vault password: [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************** TASK [Create and tag control node if it does not already exist.] ******************************************************** changed: [localhost] PLAY [localhost] ******************************************************************************************************** TASK [Change instance state to running (by tag Name)] ******************************************************************* ok: [localhost] PLAY [localhost] ******************************************************************************************************** TASK [get info about control node] ************************************************************************************** ok: [localhost] TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "ControlNode has public ip 54.89.238.46 and private ip 172.31.83.233" } TASK [Add ec2 control node to our in-memory inventory.] ***************************************************************** changed: [localhost] PLAY [appstore_control_node_group] ************************************************************************************** TASK [update already-installed software] ******************************************************************************** fatal: [54.89.238.46]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 54.89.238.46 port 22: Connection refused", "unreachable": true} PLAY RECAP ************************************************************************************************************** 54.89.238.46 : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 localhost : ok=5 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 Chesters-MacBook-Pro:ControlNode chesterdias$ ssh -i "MyNVKEY.pem" ec2-user@ec2-54-89-238-46.compute-1.amazonaws.com Warning: Identity file MyNVKEY.pem not accessible: No such file or directory. The authenticity of host 'ec2-54-89-238-46.compute-1.amazonaws.com (54.89.238.46)' can't be established. ECDSA key fingerprint is SHA256:emd7eN899c22xOnwYbQNo8yECAIgag+iPNEWQ8h1TnA. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 'ec2-54-89-238-46.compute-1.amazonaws.com,54.89.238.46' (ECDSA) to the list of known hosts. __| __|_ ) _| ( / Amazon Linux 2 AMI ___|\___|___| https://aws.amazon.com/amazon-linux-2/ 1 package(s) needed for security, out of 7 available Run "sudo yum update" to apply all updates. -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory [ec2-user@ip-172-31-83-233 ~]$ exit logout Connection to ec2-54-89-238-46.compute-1.amazonaws.com closed. Chesters-MacBook-Pro:ControlNode chesterdias$ ansible-playbook --ask-vault-pass control_node.yml Vault password: [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************** TASK [Create and tag control node if it does not already exist.] ******************************************************** ok: [localhost] PLAY [localhost] ******************************************************************************************************** TASK [Change instance state to running (by tag Name)] ******************************************************************* ok: [localhost] PLAY [localhost] ******************************************************************************************************** TASK [get info about control node] ************************************************************************************** ok: [localhost] TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "ControlNode has public ip 54.89.238.46 and private ip 172.31.83.233" } TASK [Add ec2 control node to our in-memory inventory.] ***************************************************************** changed: [localhost] PLAY [appstore_control_node_group] ************************************************************************************** TASK [update already-installed software] ******************************************************************************** [WARNING]: Platform linux on host 54.89.238.46 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. changed: [54.89.238.46] TASK [install git, emacs, pip, python3] ********************************************************************************* changed: [54.89.238.46] TASK [Install boto, boto3, ansible, PyMySQL] **************************************************************************** changed: [54.89.238.46] TASK [customize the prompt for root user] ******************************************************************************* changed: [54.89.238.46] TASK [create git alias ls for root user] ******************************************************************************** changed: [54.89.238.46] TASK [create git alias ll for root user] ******************************************************************************** changed: [54.89.238.46] TASK [create git alias alias for root user] ***************************************************************************** changed: [54.89.238.46] TASK [set git user] ***************************************************************************************************** changed: [54.89.238.46] TASK [set git email] **************************************************************************************************** changed: [54.89.238.46] TASK [copy private key for future appstores' keypair to control node] *************************************************** changed: [54.89.238.46] PLAY [appstore_control_node_group] ************************************************************************************** TASK [Gathering Facts] ************************************************************************************************** ok: [54.89.238.46] TASK [customize the prompt for ec2-user user] *************************************************************************** changed: [54.89.238.46] TASK [generate key pair for control node ec2-user] ********************************************************************** changed: [54.89.238.46] TASK [fetch the public key from control node] *************************************************************************** changed: [54.89.238.46] TASK [create git alias ls for ec2-user] ********************************************************************************* changed: [54.89.238.46] TASK [create git alias ll for ec2-user] ********************************************************************************* changed: [54.89.238.46] TASK [create git alias alias for ec2-user] ****************************************************************************** changed: [54.89.238.46] TASK [set git user] ***************************************************************************************************** changed: [54.89.238.46] TASK [set git email] **************************************************************************************************** changed: [54.89.238.46] PLAY [localhost] ******************************************************************************************************** TASK [get RDS host security group info] ********************************************************************************* ok: [localhost] TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "RDS host dev has security_group_id sg-da5a0199" } TASK [get control node private IP address] ****************************************************************************** ok: [localhost] TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "Control node ControlNode has private ip 172.31.83.233" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "It's all good! Now do the following steps:" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "1) Copy the your control node's public key id_rsa.pub to your Bitbucket account." } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": " 2) Run the following aws cli command:" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "aws ec2 authorize-security-group-ingress --group-id sg-da5a0199 --protocol tcp --port 3306 --cidr 172.31.83.233/32" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "Once you have done the above, re-run this playbook to clone the appstore-playbook repo onto the control node." } PLAY [appstore_control_node_group] ************************************************************************************** TASK [Gathering Facts] ************************************************************************************************** ok: [54.89.238.46] TASK [clone git@bitbucket.org:lorainelab/appstore-playbooks.git onto the control node] ********************************** fatal: [54.89.238.46]: FAILED! => {"changed": false, "cmd": "/usr/bin/git clone --origin origin '' /home/ec2-user/appstore-playbooks", "msg": "Cloning into '/home/ec2-user/appstore-playbooks'...\nWarning: Permanently added 'bitbucket.org,18.205.93.2' (RSA) to the list of known hosts.\r\nPermission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.", "rc": 128, "stderr": "Cloning into '/home/ec2-user/appstore-playbooks'...\nWarning: Permanently added 'bitbucket.org,18.205.93.2' (RSA) to the list of known hosts.\r\nPermission denied (publickey).\r\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n", "stderr_lines": ["Cloning into '/home/ec2-user/appstore-playbooks'...", "Warning: Permanently added 'bitbucket.org,18.205.93.2' (RSA) to the list of known hosts.", "Permission denied (publickey).", "fatal: Could not read from remote repository.", "", "Please make sure you have the correct access rights", "and the repository exists."], "stdout": "", "stdout_lines": []} PLAY RECAP ************************************************************************************************************** 54.89.238.46 : ok=20 changed=18 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 localhost : ok=14 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 Chesters-MacBook-Pro:ControlNode chesterdias$ ansible-playbook --ask-vault-pass control_node.yml Vault password: [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] ******************************************************************************************************** TASK [Create and tag control node if it does not already exist.] ******************************************************** ok: [localhost] PLAY [localhost] ******************************************************************************************************** TASK [Change instance state to running (by tag Name)] ******************************************************************* ok: [localhost] PLAY [localhost] ******************************************************************************************************** TASK [get info about control node] ************************************************************************************** ok: [localhost] TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "ControlNode has public ip 54.89.238.46 and private ip 172.31.83.233" } TASK [Add ec2 control node to our in-memory inventory.] ***************************************************************** changed: [localhost] PLAY [appstore_control_node_group] ************************************************************************************** TASK [update already-installed software] ******************************************************************************** [WARNING]: Platform linux on host 54.89.238.46 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. ok: [54.89.238.46] TASK [install git, emacs, pip, python3] ********************************************************************************* ok: [54.89.238.46] TASK [Install boto, boto3, ansible, PyMySQL] **************************************************************************** ok: [54.89.238.46] TASK [customize the prompt for root user] ******************************************************************************* ok: [54.89.238.46] TASK [create git alias ls for root user] ******************************************************************************** ok: [54.89.238.46] TASK [create git alias ll for root user] ******************************************************************************** ok: [54.89.238.46] TASK [create git alias alias for root user] ***************************************************************************** ok: [54.89.238.46] TASK [set git user] ***************************************************************************************************** ok: [54.89.238.46] TASK [set git email] **************************************************************************************************** ok: [54.89.238.46] TASK [copy private key for future appstores' keypair to control node] *************************************************** ok: [54.89.238.46] PLAY [appstore_control_node_group] ************************************************************************************** TASK [Gathering Facts] ************************************************************************************************** ok: [54.89.238.46] TASK [customize the prompt for ec2-user user] *************************************************************************** ok: [54.89.238.46] TASK [generate key pair for control node ec2-user] ********************************************************************** ok: [54.89.238.46] TASK [fetch the public key from control node] *************************************************************************** ok: [54.89.238.46] TASK [create git alias ls for ec2-user] ********************************************************************************* ok: [54.89.238.46] TASK [create git alias ll for ec2-user] ********************************************************************************* ok: [54.89.238.46] TASK [create git alias alias for ec2-user] ****************************************************************************** ok: [54.89.238.46] TASK [set git user] ***************************************************************************************************** ok: [54.89.238.46] TASK [set git email] **************************************************************************************************** ok: [54.89.238.46] PLAY [localhost] ******************************************************************************************************** TASK [get RDS host security group info] ********************************************************************************* ok: [localhost] TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "RDS host dev has security_group_id sg-da5a0199" } TASK [get control node private IP address] ****************************************************************************** ok: [localhost] TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "Control node ControlNode has private ip 172.31.83.233" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "It's all good! Now do the following steps:" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "1) Copy the your control node's public key id_rsa.pub to your Bitbucket account." } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": " 2) Run the following aws cli command:" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "aws ec2 authorize-security-group-ingress --group-id sg-da5a0199 --protocol tcp --port 3306 --cidr 172.31.83.233/32" } TASK [debug] ************************************************************************************************************ ok: [localhost] => { "msg": "Once you have done the above, re-run this playbook to clone the appstore-playbook repo onto the control node." } PLAY [appstore_control_node_group] ************************************************************************************** TASK [Gathering Facts] ************************************************************************************************** ok: [54.89.238.46] TASK [clone git@bitbucket.org:lorainelab/appstore-playbooks.git onto the control node] ********************************** changed: [54.89.238.46] PLAY [localhost] ******************************************************************************************************** TASK [How to log in!] *************************************************************************************************** ok: [localhost] => { "msg": "ssh -i MyNVKEY.pem ec2-user@54.89.238.46" } PLAY RECAP ************************************************************************************************************** 54.89.238.46 : ok=21 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 localhost : ok=15 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 Chesters-MacBook-Pro:ControlNode chesterdias$ ssh -i MyNVKEY.pem ec2-user@54.89.238.46 Warning: Identity file MyNVKEY.pem not accessible: No such file or directory. Last login: Tue Apr 14 15:24:42 2020 from cpe-172-73-65-150.carolina.res.rr.com __| __|_ ) _| ( / Amazon Linux 2 AMI ___|\___|___| https://aws.amazon.com/amazon-linux-2/ -bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory ControlNode ec2-user $ pwd /home/ec2-user ControlNode ec2-user $ ls MyNVKEY1.pem appstore-playbooks ControlNode ec2-user $ cd appstore-playbooks/ ControlNode ec2-user $ ls Ansible ControlNode Points to remember.txt README.md just_the_facts.yml protected_variables.txt ControlNode ec2-user $ cd ControlNode ec2-user $ python3 Python 3.7.6 (default, Feb 26 2020, 20:54:15) [GCC 7.3.1 20180712 (Red Hat 7.3.1-6)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit() ControlNode ec2-user $ pip3 list Package Version --------------- ------- ansible 2.9.6 boto 2.49.0 boto3 1.12.39 botocore 1.15.39 cffi 1.14.0 cryptography 2.9 docutils 0.15.2 Jinja2 2.11.2 jmespath 0.9.5 MarkupSafe 1.1.1 pip 9.0.3 pycparser 2.20 PyMySQL 0.9.3 python-dateutil 2.8.1 PyYAML 5.3.1 s3transfer 0.3.3 setuptools 38.4.0 six 1.14.0 urllib3 1.25.8 ControlNode ec2-user $ ansible --version ansible 2.9.6 config file = None configured module search path = ['/home/ec2-user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.7/site-packages/ansible executable location = /usr/local/bin/ansible python version = 3.7.6 (default, Feb 26 2020, 20:54:15) [GCC 7.3.1 20180712 (Red Hat 7.3.1-6)] ControlNode ec2-user $