Skip to content

Instantly share code, notes, and snippets.

@rquadling
Created May 15, 2020 12:46
Show Gist options
  • Save rquadling/d8bb3cc4f05b1c4ec82046f4ea7e2ab2 to your computer and use it in GitHub Desktop.
Save rquadling/d8bb3cc4f05b1c4ec82046f4ea7e2ab2 to your computer and use it in GitHub Desktop.
Failed and successful install of AWS Cloudwatch Daemon using Ansible
amazon-ebs: TASK [aws_cloudwatch_logs : Install the AWS CloudWatch Logs daemon] ************
amazon-ebs: task path: /tmp/packer-provisioner-ansible-local/5ebe8377-f9d0-f655-9be8-665b6e0204c8/roles/aws_cloudwatch_logs/tasks/install.yml:26
amazon-ebs: changed: [127.0.0.1] => {"changed": true, "cmd": "python /tmp/awslogs-agent-setup.py -n -r eu-west-1 -c /tmp/awslogs.conf", "delta": "0:00:25.998340", "end": "2020-05-15 12:12:01.446602", "rc": 0, "start": "2020-05-15 12:11:35.448262", "stderr": "", "stderr_lines": [], "stdout": "downloading AgentDependencies.tar.gz with urllib
\u001b[0mAgentDependencies/
AgentDependencies/awslogscli/
AgentDependencies/awslogscli/urllib3-1.25.6.tar.gz
AgentDependencies/awslogscli/jmespath-0.9.2.tar.gz
AgentDependencies/awslogscli/colorama-0.3.7.zip
AgentDependencies/awslogscli/idna-2.8.tar.gz
AgentDependencies/awslogscli/awscli-1.11.41.tar.gz
AgentDependencies/awslogscli/argparse-1.2.1.tar.gz
AgentDependencies/awslogscli/botocore-1.13.9.tar.gz
AgentDependencies/awslogscli/docutils-0.15.2.tar.gz
AgentDependencies/awslogscli/pyasn1-0.2.3.tar.gz
AgentDependencies/awslogscli/python-dateutil-2.6.0.tar.gz
AgentDependencies/awslogscli/botocore-1.5.4.tar.gz
AgentDependencies/awslogscli/jmespath-0.9.4.tar.gz
AgentDependencies/awslogscli/awscli-cwlogs-1.4.6.tar.gz
AgentDependencies/awslogscli/ordereddict-1.1.tar.gz
AgentDependencies/awslogscli/futures-3.3.0.tar.gz
AgentDependencies/awslogscli/futures-3.0.5.tar.gz
AgentDependencies/awslogscli/certifi-2019.9.11.tar.gz
AgentDependencies/awslogscli/six-1.12.0.tar.gz
AgentDependencies/awslogscli/s3transfer-0.1.10.tar.gz
AgentDependencies/awslogscli/six-1.10.0.tar.gz
AgentDependencies/awslogscli/requests-2.18.4.tar.gz
AgentDependencies/awslogscli/rsa-3.4.2.tar.gz
AgentDependencies/awslogscli/s3transfer-0.2.1.tar.gz
AgentDependencies/awslogscli/docutils-0.13.1.tar.gz
AgentDependencies/awslogscli/urllib3-1.22.tar.gz
AgentDependencies/awslogscli/awscli-1.16.273.tar.gz
AgentDependencies/awslogscli/PyYAML-5.1.2.tar.gz
AgentDependencies/awslogscli/idna-2.5.tar.gz
AgentDependencies/awslogscli/PyYAML-3.12.tar.gz
AgentDependencies/awslogscli/pyasn1-0.4.7.tar.gz
AgentDependencies/awslogscli/colorama-0.4.1.tar.gz
AgentDependencies/awslogscli/simplejson-3.3.0.tar.gz
AgentDependencies/awslogscli/chardet-3.0.4.tar.gz
AgentDependencies/virtualenv-15.1.0/
AgentDependencies/virtualenv-15.1.0/setup.cfg
AgentDependencies/virtualenv-15.1.0/tests/
AgentDependencies/virtualenv-15.1.0/tests/__init__.py
AgentDependencies/virtualenv-15.1.0/tests/test_cmdline.py
AgentDependencies/virtualenv-15.1.0/tests/test_virtualenv.py
AgentDependencies/virtualenv-15.1.0/tests/test_activate_output.expected
AgentDependencies/virtualenv-15.1.0/tests/test_activate.sh
AgentDependencies/virtualenv-15.1.0/scripts/
AgentDependencies/virtualenv-15.1.0/scripts/virtualenv
AgentDependencies/virtualenv-15.1.0/virtualenv.py
AgentDependencies/virtualenv-15.1.0/MANIFEST.in
AgentDependencies/virtualenv-15.1.0/README.rst
AgentDependencies/virtualenv-15.1.0/AUTHORS.txt
AgentDependencies/virtualenv-15.1.0/setup.py
AgentDependencies/virtualenv-15.1.0/LICENSE.txt
AgentDependencies/virtualenv-15.1.0/virtualenv_support/
AgentDependencies/virtualenv-15.1.0/virtualenv_support/__init__.py
AgentDependencies/virtualenv-15.1.0/virtualenv_support/wheel-0.29.0-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/virtualenv_support/setuptools-28.8.0-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/PKG-INFO
AgentDependencies/virtualenv-15.1.0/bin/
AgentDependencies/virtualenv-15.1.0/bin/rebuild-script.py
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/not-zip-safe
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/SOURCES.txt
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/entry_points.txt
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/top_level.txt
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/PKG-INFO
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/dependency_links.txt
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.ps1
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.csh
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/deactivate.bat
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate_this.py
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.fish
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/python-config
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.bat
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils.cfg
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/site.py
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.sh
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils-init.py
AgentDependencies/virtualenv-15.1.0/docs/
AgentDependencies/virtualenv-15.1.0/docs/userguide.rst
AgentDependencies/virtualenv-15.1.0/docs/index.rst
AgentDependencies/virtualenv-15.1.0/docs/development.rst
AgentDependencies/virtualenv-15.1.0/docs/reference.rst
AgentDependencies/virtualenv-15.1.0/docs/Makefile
AgentDependencies/virtualenv-15.1.0/docs/conf.py
AgentDependencies/virtualenv-15.1.0/docs/changes.rst
AgentDependencies/virtualenv-15.1.0/docs/installation.rst
AgentDependencies/virtualenv-15.1.0/docs/make.bat
AgentDependencies/pip-6.1.1.tar.gz
Step 1 of 5: Installing pip ...\u001b[0m\u001b[92mDONE\u001b[0m
Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... \u001b[0m\u001b[92mDONE\u001b[0m
Step 5 of 5: Setting up agent as a daemon ...\u001b[0m\u001b[92mDONE\u001b[0m
------------------------------------------------------\u001b[0m
- Configuration file successfully saved at: /var/awslogs/etc/awslogs.conf\u001b[0m
- You can begin accessing new log events after a few moments at https://console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logs:\u001b[0m
- You can use 'sudo service awslogs start|stop|status|restart' to control the daemon.\u001b[0m
- To see diagnostic information for the CloudWatch Logs Agent, see /var/log/awslogs.log\u001b[0m
- You can rerun interactive setup using 'sudo python ./awslogs-agent-setup.py --region eu-west-1 --only-generate-config'\u001b[0m
------------------------------------------------------
\u001b[0m", "stdout_lines": ["downloading AgentDependencies.tar.gz with urllib", "\u001b[0mAgentDependencies/", "AgentDependencies/awslogscli/", "AgentDependencies/awslogscli/urllib3-1.25.6.tar.gz", "AgentDependencies/awslogscli/jmespath-0.9.2.tar.gz", "AgentDependencies/awslogscli/colorama-0.3.7.zip", "AgentDependencies/awslogscli/idna-2.8.tar.gz", "AgentDependencies/awslogscli/awscli-1.11.41.tar.gz", "AgentDependencies/awslogscli/argparse-1.2.1.tar.gz", "AgentDependencies/awslogscli/botocore-1.13.9.tar.gz", "AgentDependencies/awslogscli/docutils-0.15.2.tar.gz", "AgentDependencies/awslogscli/pyasn1-0.2.3.tar.gz", "AgentDependencies/awslogscli/python-dateutil-2.6.0.tar.gz", "AgentDependencies/awslogscli/botocore-1.5.4.tar.gz", "AgentDependencies/awslogscli/jmespath-0.9.4.tar.gz", "AgentDependencies/awslogscli/awscli-cwlogs-1.4.6.tar.gz", "AgentDependencies/awslogscli/ordereddict-1.1.tar.gz", "AgentDependencies/awslogscli/futures-3.3.0.tar.gz", "AgentDependencies/awslogscli/futures-3.0.5.tar.gz", "AgentDependencies/awslogscli/certifi-2019.9.11.tar.gz", "AgentDependencies/awslogscli/six-1.12.0.tar.gz", "AgentDependencies/awslogscli/s3transfer-0.1.10.tar.gz", "AgentDependencies/awslogscli/six-1.10.0.tar.gz", "AgentDependencies/awslogscli/requests-2.18.4.tar.gz", "AgentDependencies/awslogscli/rsa-3.4.2.tar.gz", "AgentDependencies/awslogscli/s3transfer-0.2.1.tar.gz", "AgentDependencies/awslogscli/docutils-0.13.1.tar.gz", "AgentDependencies/awslogscli/urllib3-1.22.tar.gz", "AgentDependencies/awslogscli/awscli-1.16.273.tar.gz", "AgentDependencies/awslogscli/PyYAML-5.1.2.tar.gz", "AgentDependencies/awslogscli/idna-2.5.tar.gz", "AgentDependencies/awslogscli/PyYAML-3.12.tar.gz", "AgentDependencies/awslogscli/pyasn1-0.4.7.tar.gz", "AgentDependencies/awslogscli/colorama-0.4.1.tar.gz", "AgentDependencies/awslogscli/simplejson-3.3.0.tar.gz", "AgentDependencies/awslogscli/chardet-3.0.4.tar.gz", "AgentDependencies/virtualenv-15.1.0/", "AgentDependencies/virtualenv-15.1.0/setup.cfg", "AgentDependencies/virtualenv-15.1.0/tests/", "AgentDependencies/virtualenv-15.1.0/tests/__init__.py", "AgentDependencies/virtualenv-15.1.0/tests/test_cmdline.py", "AgentDependencies/virtualenv-15.1.0/tests/test_virtualenv.py", "AgentDependencies/virtualenv-15.1.0/tests/test_activate_output.expected", "AgentDependencies/virtualenv-15.1.0/tests/test_activate.sh", "AgentDependencies/virtualenv-15.1.0/scripts/", "AgentDependencies/virtualenv-15.1.0/scripts/virtualenv", "AgentDependencies/virtualenv-15.1.0/virtualenv.py", "AgentDependencies/virtualenv-15.1.0/MANIFEST.in", "AgentDependencies/virtualenv-15.1.0/README.rst", "AgentDependencies/virtualenv-15.1.0/AUTHORS.txt", "AgentDependencies/virtualenv-15.1.0/setup.py", "AgentDependencies/virtualenv-15.1.0/LICENSE.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/__init__.py", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/wheel-0.29.0-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/setuptools-28.8.0-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/PKG-INFO", "AgentDependencies/virtualenv-15.1.0/bin/", "AgentDependencies/virtualenv-15.1.0/bin/rebuild-script.py", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/not-zip-safe", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/SOURCES.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/entry_points.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/top_level.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/PKG-INFO", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/dependency_links.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.ps1", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.csh", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/deactivate.bat", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate_this.py", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.fish", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/python-config", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.bat", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils.cfg", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/site.py", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.sh", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils-init.py", "AgentDependencies/virtualenv-15.1.0/docs/", "AgentDependencies/virtualenv-15.1.0/docs/userguide.rst", "AgentDependencies/virtualenv-15.1.0/docs/index.rst", "AgentDependencies/virtualenv-15.1.0/docs/development.rst", "AgentDependencies/virtualenv-15.1.0/docs/reference.rst", "AgentDependencies/virtualenv-15.1.0/docs/Makefile", "AgentDependencies/virtualenv-15.1.0/docs/conf.py", "AgentDependencies/virtualenv-15.1.0/docs/changes.rst", "AgentDependencies/virtualenv-15.1.0/docs/installation.rst", "AgentDependencies/virtualenv-15.1.0/docs/make.bat", "AgentDependencies/pip-6.1.1.tar.gz", "", "Step 1 of 5: Installing pip ...\u001b[0m\u001b[92mDONE\u001b[0m", "", "Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... \u001b[0m\u001b[92mDONE\u001b[0m", "", "", "Step 5 of 5: Setting up agent as a daemon ...\u001b[0m\u001b[92mDONE\u001b[0m", "", "", "------------------------------------------------------\u001b[0m", "- Configuration file successfully saved at: /var/awslogs/etc/awslogs.conf\u001b[0m", "- You can begin accessing new log events after a few moments at https://console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logs:\u001b[0m", "- You can use 'sudo service awslogs start|stop|status|restart' to control the daemon.\u001b[0m", "- To see diagnostic information for the CloudWatch Logs Agent, see /var/log/awslogs.log\u001b[0m", "- You can rerun interactive setup using 'sudo python ./awslogs-agent-setup.py --region eu-west-1 --only-generate-config'\u001b[0m", "------------------------------------------------------", "\u001b[0m"]}
Failed to get AMI ID from the last line. Something went wrong.
amazon-ebs:
amazon-ebs: TASK [aws_cloudwatch_logs : Turn off awslogs] **********************************
amazon-ebs: task path: /tmp/packer-provisioner-ansible-local/5ebe8377-f9d0-f655-9be8-665b6e0204c8/roles/aws_cloudwatch_logs/tasks/install.yml:30
amazon-ebs: fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Unable to stop service awslogs: Job for awslogs.service canceled.
"}
amazon-ebs:
amazon-ebs: TASK [aws_cloudwatch_logs : Install the AWS CloudWatch Logs daemon] ************
amazon-ebs: task path: /tmp/packer-provisioner-ansible-local/5ebe895f-14b3-1112-dcda-88f531e2d3cd/roles/aws_cloudwatch_logs/tasks/install.yml:26
amazon-ebs: changed: [127.0.0.1] => {"changed": true, "cmd": "python /tmp/awslogs-agent-setup.py -n -r eu-west-1 -c /tmp/awslogs.conf", "delta": "0:00:25.716836", "end": "2020-05-15 12:35:28.690028", "rc": 0, "start": "2020-05-15 12:35:02.973192", "stderr": "", "stderr_lines": [], "stdout": "downloading AgentDependencies.tar.gz with urllib
\u001b[0mAgentDependencies/
AgentDependencies/awslogscli/
AgentDependencies/awslogscli/urllib3-1.25.6.tar.gz
AgentDependencies/awslogscli/jmespath-0.9.2.tar.gz
AgentDependencies/awslogscli/colorama-0.3.7.zip
AgentDependencies/awslogscli/idna-2.8.tar.gz
AgentDependencies/awslogscli/awscli-1.11.41.tar.gz
AgentDependencies/awslogscli/argparse-1.2.1.tar.gz
AgentDependencies/awslogscli/botocore-1.13.9.tar.gz
AgentDependencies/awslogscli/docutils-0.15.2.tar.gz
AgentDependencies/awslogscli/pyasn1-0.2.3.tar.gz
AgentDependencies/awslogscli/python-dateutil-2.6.0.tar.gz
AgentDependencies/awslogscli/botocore-1.5.4.tar.gz
AgentDependencies/awslogscli/jmespath-0.9.4.tar.gz
AgentDependencies/awslogscli/awscli-cwlogs-1.4.6.tar.gz
AgentDependencies/awslogscli/ordereddict-1.1.tar.gz
AgentDependencies/awslogscli/futures-3.3.0.tar.gz
AgentDependencies/awslogscli/futures-3.0.5.tar.gz
AgentDependencies/awslogscli/certifi-2019.9.11.tar.gz
AgentDependencies/awslogscli/six-1.12.0.tar.gz
AgentDependencies/awslogscli/s3transfer-0.1.10.tar.gz
AgentDependencies/awslogscli/six-1.10.0.tar.gz
AgentDependencies/awslogscli/requests-2.18.4.tar.gz
AgentDependencies/awslogscli/rsa-3.4.2.tar.gz
AgentDependencies/awslogscli/s3transfer-0.2.1.tar.gz
AgentDependencies/awslogscli/docutils-0.13.1.tar.gz
AgentDependencies/awslogscli/urllib3-1.22.tar.gz
AgentDependencies/awslogscli/awscli-1.16.273.tar.gz
AgentDependencies/awslogscli/PyYAML-5.1.2.tar.gz
AgentDependencies/awslogscli/idna-2.5.tar.gz
AgentDependencies/awslogscli/PyYAML-3.12.tar.gz
AgentDependencies/awslogscli/pyasn1-0.4.7.tar.gz
AgentDependencies/awslogscli/colorama-0.4.1.tar.gz
AgentDependencies/awslogscli/simplejson-3.3.0.tar.gz
AgentDependencies/awslogscli/chardet-3.0.4.tar.gz
AgentDependencies/virtualenv-15.1.0/
AgentDependencies/virtualenv-15.1.0/setup.cfg
AgentDependencies/virtualenv-15.1.0/tests/
AgentDependencies/virtualenv-15.1.0/tests/__init__.py
AgentDependencies/virtualenv-15.1.0/tests/test_cmdline.py
AgentDependencies/virtualenv-15.1.0/tests/test_virtualenv.py
AgentDependencies/virtualenv-15.1.0/tests/test_activate_output.expected
AgentDependencies/virtualenv-15.1.0/tests/test_activate.sh
AgentDependencies/virtualenv-15.1.0/scripts/
AgentDependencies/virtualenv-15.1.0/scripts/virtualenv
AgentDependencies/virtualenv-15.1.0/virtualenv.py
AgentDependencies/virtualenv-15.1.0/MANIFEST.in
AgentDependencies/virtualenv-15.1.0/README.rst
AgentDependencies/virtualenv-15.1.0/AUTHORS.txt
AgentDependencies/virtualenv-15.1.0/setup.py
AgentDependencies/virtualenv-15.1.0/LICENSE.txt
AgentDependencies/virtualenv-15.1.0/virtualenv_support/
AgentDependencies/virtualenv-15.1.0/virtualenv_support/__init__.py
AgentDependencies/virtualenv-15.1.0/virtualenv_support/wheel-0.29.0-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/virtualenv_support/setuptools-28.8.0-py2.py3-none-any.whl
AgentDependencies/virtualenv-15.1.0/PKG-INFO
AgentDependencies/virtualenv-15.1.0/bin/
AgentDependencies/virtualenv-15.1.0/bin/rebuild-script.py
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/not-zip-safe
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/SOURCES.txt
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/entry_points.txt
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/top_level.txt
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/PKG-INFO
AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/dependency_links.txt
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.ps1
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.csh
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/deactivate.bat
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate_this.py
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.fish
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/python-config
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.bat
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils.cfg
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/site.py
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.sh
AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils-init.py
AgentDependencies/virtualenv-15.1.0/docs/
AgentDependencies/virtualenv-15.1.0/docs/userguide.rst
AgentDependencies/virtualenv-15.1.0/docs/index.rst
AgentDependencies/virtualenv-15.1.0/docs/development.rst
AgentDependencies/virtualenv-15.1.0/docs/reference.rst
AgentDependencies/virtualenv-15.1.0/docs/Makefile
AgentDependencies/virtualenv-15.1.0/docs/conf.py
AgentDependencies/virtualenv-15.1.0/docs/changes.rst
AgentDependencies/virtualenv-15.1.0/docs/installation.rst
AgentDependencies/virtualenv-15.1.0/docs/make.bat
AgentDependencies/pip-6.1.1.tar.gz
Step 1 of 5: Installing pip ...\u001b[0m\u001b[92mDONE\u001b[0m
Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... \u001b[0m\u001b[92mDONE\u001b[0m
Step 5 of 5: Setting up agent as a daemon ...\u001b[0m\u001b[92mDONE\u001b[0m
------------------------------------------------------\u001b[0m
- Configuration file successfully saved at: /var/awslogs/etc/awslogs.conf\u001b[0m
- You can begin accessing new log events after a few moments at https://console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logs:\u001b[0m
- You can use 'sudo service awslogs start|stop|status|restart' to control the daemon.\u001b[0m
- To see diagnostic information for the CloudWatch Logs Agent, see /var/log/awslogs.log\u001b[0m
- You can rerun interactive setup using 'sudo python ./awslogs-agent-setup.py --region eu-west-1 --only-generate-config'\u001b[0m
------------------------------------------------------
\u001b[0m", "stdout_lines": ["downloading AgentDependencies.tar.gz with urllib", "\u001b[0mAgentDependencies/", "AgentDependencies/awslogscli/", "AgentDependencies/awslogscli/urllib3-1.25.6.tar.gz", "AgentDependencies/awslogscli/jmespath-0.9.2.tar.gz", "AgentDependencies/awslogscli/colorama-0.3.7.zip", "AgentDependencies/awslogscli/idna-2.8.tar.gz", "AgentDependencies/awslogscli/awscli-1.11.41.tar.gz", "AgentDependencies/awslogscli/argparse-1.2.1.tar.gz", "AgentDependencies/awslogscli/botocore-1.13.9.tar.gz", "AgentDependencies/awslogscli/docutils-0.15.2.tar.gz", "AgentDependencies/awslogscli/pyasn1-0.2.3.tar.gz", "AgentDependencies/awslogscli/python-dateutil-2.6.0.tar.gz", "AgentDependencies/awslogscli/botocore-1.5.4.tar.gz", "AgentDependencies/awslogscli/jmespath-0.9.4.tar.gz", "AgentDependencies/awslogscli/awscli-cwlogs-1.4.6.tar.gz", "AgentDependencies/awslogscli/ordereddict-1.1.tar.gz", "AgentDependencies/awslogscli/futures-3.3.0.tar.gz", "AgentDependencies/awslogscli/futures-3.0.5.tar.gz", "AgentDependencies/awslogscli/certifi-2019.9.11.tar.gz", "AgentDependencies/awslogscli/six-1.12.0.tar.gz", "AgentDependencies/awslogscli/s3transfer-0.1.10.tar.gz", "AgentDependencies/awslogscli/six-1.10.0.tar.gz", "AgentDependencies/awslogscli/requests-2.18.4.tar.gz", "AgentDependencies/awslogscli/rsa-3.4.2.tar.gz", "AgentDependencies/awslogscli/s3transfer-0.2.1.tar.gz", "AgentDependencies/awslogscli/docutils-0.13.1.tar.gz", "AgentDependencies/awslogscli/urllib3-1.22.tar.gz", "AgentDependencies/awslogscli/awscli-1.16.273.tar.gz", "AgentDependencies/awslogscli/PyYAML-5.1.2.tar.gz", "AgentDependencies/awslogscli/idna-2.5.tar.gz", "AgentDependencies/awslogscli/PyYAML-3.12.tar.gz", "AgentDependencies/awslogscli/pyasn1-0.4.7.tar.gz", "AgentDependencies/awslogscli/colorama-0.4.1.tar.gz", "AgentDependencies/awslogscli/simplejson-3.3.0.tar.gz", "AgentDependencies/awslogscli/chardet-3.0.4.tar.gz", "AgentDependencies/virtualenv-15.1.0/", "AgentDependencies/virtualenv-15.1.0/setup.cfg", "AgentDependencies/virtualenv-15.1.0/tests/", "AgentDependencies/virtualenv-15.1.0/tests/__init__.py", "AgentDependencies/virtualenv-15.1.0/tests/test_cmdline.py", "AgentDependencies/virtualenv-15.1.0/tests/test_virtualenv.py", "AgentDependencies/virtualenv-15.1.0/tests/test_activate_output.expected", "AgentDependencies/virtualenv-15.1.0/tests/test_activate.sh", "AgentDependencies/virtualenv-15.1.0/scripts/", "AgentDependencies/virtualenv-15.1.0/scripts/virtualenv", "AgentDependencies/virtualenv-15.1.0/virtualenv.py", "AgentDependencies/virtualenv-15.1.0/MANIFEST.in", "AgentDependencies/virtualenv-15.1.0/README.rst", "AgentDependencies/virtualenv-15.1.0/AUTHORS.txt", "AgentDependencies/virtualenv-15.1.0/setup.py", "AgentDependencies/virtualenv-15.1.0/LICENSE.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/__init__.py", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/wheel-0.29.0-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/argparse-1.4.0-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/pip-9.0.1-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/virtualenv_support/setuptools-28.8.0-py2.py3-none-any.whl", "AgentDependencies/virtualenv-15.1.0/PKG-INFO", "AgentDependencies/virtualenv-15.1.0/bin/", "AgentDependencies/virtualenv-15.1.0/bin/rebuild-script.py", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/not-zip-safe", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/SOURCES.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/entry_points.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/top_level.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/PKG-INFO", "AgentDependencies/virtualenv-15.1.0/virtualenv.egg-info/dependency_links.txt", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.ps1", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.csh", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/deactivate.bat", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate_this.py", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.fish", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/python-config", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.bat", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils.cfg", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/site.py", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/activate.sh", "AgentDependencies/virtualenv-15.1.0/virtualenv_embedded/distutils-init.py", "AgentDependencies/virtualenv-15.1.0/docs/", "AgentDependencies/virtualenv-15.1.0/docs/userguide.rst", "AgentDependencies/virtualenv-15.1.0/docs/index.rst", "AgentDependencies/virtualenv-15.1.0/docs/development.rst", "AgentDependencies/virtualenv-15.1.0/docs/reference.rst", "AgentDependencies/virtualenv-15.1.0/docs/Makefile", "AgentDependencies/virtualenv-15.1.0/docs/conf.py", "AgentDependencies/virtualenv-15.1.0/docs/changes.rst", "AgentDependencies/virtualenv-15.1.0/docs/installation.rst", "AgentDependencies/virtualenv-15.1.0/docs/make.bat", "AgentDependencies/pip-6.1.1.tar.gz", "", "Step 1 of 5: Installing pip ...\u001b[0m\u001b[92mDONE\u001b[0m", "", "Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... \u001b[0m\u001b[92mDONE\u001b[0m", "", "", "Step 5 of 5: Setting up agent as a daemon ...\u001b[0m\u001b[92mDONE\u001b[0m", "", "", "------------------------------------------------------\u001b[0m", "- Configuration file successfully saved at: /var/awslogs/etc/awslogs.conf\u001b[0m", "- You can begin accessing new log events after a few moments at https://console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logs:\u001b[0m", "- You can use 'sudo service awslogs start|stop|status|restart' to control the daemon.\u001b[0m", "- To see diagnostic information for the CloudWatch Logs Agent, see /var/log/awslogs.log\u001b[0m", "- You can rerun interactive setup using 'sudo python ./awslogs-agent-setup.py --region eu-west-1 --only-generate-config'\u001b[0m", "------------------------------------------------------", "\u001b[0m"]}
amazon-ebs:
amazon-ebs: TASK [aws_cloudwatch_logs : Turn off awslogs] **********************************
amazon-ebs: task path: /tmp/packer-provisioner-ansible-local/5ebe895f-14b3-1112-dcda-88f531e2d3cd/roles/aws_cloudwatch_logs/tasks/install.yml:30
amazon-ebs: changed: [127.0.0.1] => {"changed": true, "enabled": false, "name": "awslogs", "state": "stopped", "status": {"ActiveEnterTimestamp": "Fri 2020-05-15 12:35:28 UTC", "ActiveEnterTimestampMonotonic": "802202388", "ActiveExitTimestampMonotonic": "0", "ActiveState": "active", "After": "system.slice basic.target networking.service systemd-journald.socket", "AllowIsolate": "no", "AssertResult": "yes", "AssertTimestamp": "Fri 2020-05-15 12:35:26 UTC", "AssertTimestampMonotonic": "800171746", "Before": "shutdown.target", "BlockIOAccounting": "no", "BlockIOWeight": "18446744073709551615", "CPUAccounting": "no", "CPUQuotaPerSecUSec": "infinity", "CPUSchedulingPolicy": "0", "CPUSchedulingPriority": "0", "CPUSchedulingResetOnFork": "no", "CPUShares": "18446744073709551615", "CanIsolate": "no", "CanReload": "no", "CanStart": "yes", "CanStop": "yes", "CapabilityBoundingSet": "18446744073709551615", "ConditionResult": "yes", "ConditionTimestamp": "Fri 2020-05-15 12:35:26 UTC", "ConditionTimestampMonotonic": "800171745", "Conflicts": "shutdown.target", "ControlGroup": "/system.slice/awslogs.service", "ControlPID": "0", "DefaultDependencies": "yes", "Delegate": "no", "Description": "LSB: Daemon for AWSLogs agent.", "DevicePolicy": "auto", "Documentation": "man:systemd-sysv-generator(8)", "ExecMainCode": "0", "ExecMainExitTimestampMonotonic": "0", "ExecMainPID": "0", "ExecMainStartTimestampMonotonic": "0", "ExecMainStatus": "0", "ExecStart": "{ path=/etc/rc.d/init.d/awslogs ; argv[]=/etc/rc.d/init.d/awslogs start ; ignore_errors=no ; start_time=[Fri 2020-05-15 12:35:26 UTC] ; stop_time=[Fri 2020-05-15 12:35:28 UTC] ; pid=19674 ; code=exited ; status=0 }", "ExecStop": "{ path=/etc/rc.d/init.d/awslogs ; argv[]=/etc/rc.d/init.d/awslogs stop ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }", "FailureAction": "none", "FileDescriptorStoreMax": "0", "FragmentPath": "/run/systemd/generator.late/awslogs.service", "GuessMainPID": "no", "IOScheduling": "0", "Id": "awslogs.service", "IgnoreOnIsolate": "no", "IgnoreOnSnapshot": "no", "IgnoreSIGPIPE": "no", "InactiveEnterTimestampMonotonic": "0", "InactiveExitTimestamp": "Fri 2020-05-15 12:35:26 UTC", "InactiveExitTimestampMonotonic": "800172197", "JobTimeoutAction": "none", "JobTimeoutUSec": "0", "KillMode": "process", "KillSignal": "15", "LimitAS": "18446744073709551615", "LimitCORE": "18446744073709551615", "LimitCPU": "18446744073709551615", "LimitDATA": "18446744073709551615", "LimitFSIZE": "18446744073709551615", "LimitLOCKS": "18446744073709551615", "LimitMEMLOCK": "65536", "LimitMSGQUEUE": "819200", "LimitNICE": "0", "LimitNOFILE": "4096", "LimitNPROC": "59357", "LimitRSS": "18446744073709551615", "LimitRTPRIO": "0", "LimitRTTIME": "18446744073709551615", "LimitSIGPENDING": "59357", "LimitSTACK": "18446744073709551615", "LoadState": "loaded", "MainPID": "0", "MemoryAccounting": "no", "MemoryCurrent": "18446744073709551615", "MemoryLimit": "18446744073709551615", "MountFlags": "0", "Names": "awslogs.service", "NeedDaemonReload": "no", "Nice": "0", "NoNewPrivileges": "no", "NonBlocking": "no", "NotifyAccess": "none", "OOMScoreAdjust": "0", "OnFailureJobMode": "replace", "PermissionsStartOnly": "no", "PrivateDevices": "no", "PrivateNetwork": "no", "PrivateTmp": "no", "ProtectHome": "no", "ProtectSystem": "no", "RefuseManualStart": "no", "RefuseManualStop": "no", "RemainAfterExit": "yes", "Requires": "basic.target", "Restart": "no", "RestartUSec": "100ms", "Result": "success", "RootDirectoryStartOnly": "no", "RuntimeDirectoryMode": "0755", "SameProcessGroup": "no", "SecureBits": "0", "SendSIGHUP": "no", "SendSIGKILL": "yes", "Slice": "system.slice", "SourcePath": "/etc/rc.d/init.d/awslogs", "StandardError": "inherit", "StandardInput": "null", "StandardOutput": "journal", "StartLimitAction": "none", "StartLimitBurst": "5", "StartLimitInterval": "10000000", "StartupBlockIOWeight": "18446744073709551615", "StartupCPUShares": "18446744073709551615", "StatusErrno": "0", "StopWhenUnneeded": "no", "SubState": "running", "SyslogLevelPrefix": "yes", "SyslogPriority": "30", "SystemCallErrorNumber": "0", "TTYReset": "no", "TTYVHangup": "no", "TTYVTDisallocate": "no", "TimeoutStartUSec": "5min", "TimeoutStopUSec": "5min", "TimerSlackNSec": "50000", "Transient": "no", "Type": "forking", "UMask": "0022", "UnitFilePreset": "disabled", "UnitFileState": "bad", "Wants": "system.slice", "WatchdogTimestamp": "Fri 2020-05-15 12:35:28 UTC", "WatchdogTimestampMonotonic": "802202363", "WatchdogUSec": "0"}}
amazon-ebs:
@rquadling
Copy link
Author

The line Failed to get AMI ID from the last line. Something went wrong. is generated by a watcher that extracts data as it is running and, as such, is correctly identifying that an AMI ID did not exist in the output.

@rquadling
Copy link
Author

The ansible role for this ...

---
- name: Install JQ
  yum: name=jq state=present

- name: Discover the EC2 instance region
  # Reversing the string is hacky but readable and efficient enough...
  shell: "curl --silent http://169.254.169.254/latest/dynamic/instance-identity/document | jq -r .region"
  register: ec2_region

- name: Configure /tmp/awslogs.conf
  template:
    dest: /tmp/awslogs.conf
    group: root
    mode: 0600
    owner: root
    src: awslogs.conf.j2

- name: Download the awslogs-agent-setup.py script
  get_url:
    dest: /tmp/awslogs-agent-setup.py
    group: root
    owner: root
    mode: 0600
    url: https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py

- name: Install the AWS CloudWatch Logs daemon
  shell: python /tmp/awslogs-agent-setup.py -n -r {{ ec2_region.stdout }} -c /tmp/awslogs.conf

# Ensure that the awslogs service does not start on boot - the service is started via the instance userdata.
- name: Turn off awslogs
  service:
    name: awslogs
    state: stopped
    enabled: no

@rquadling
Copy link
Author

If anyone reads this, I just added a 30s delay

# Pause for 30 seconds for the awslogs service has been started, even though we are about to kill it.
- pause:
    seconds: 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment