I am trying to build an amazon AMI using the EBS builder and provision it using ansible.
I am using as a source ami the Ubuntu 18.04
Despite the following settings:
"provisioners": [
{
"type": "ansible",
"extra_arguments": [
"-e 'ansible_python_interpreter=/usr/bin/python3',"
],
"playbook_file": "ansible/site.yml",
"ansible_env_vars": [ "ANSIBLE_ROLES_PATH=../ansible/roles" ,"ANSIBLE_RETRY_FILES_ENABLED=False", "ANSIBLE_PYTHON_INTERPRETER=/usr/bin/python3" ],
"user": "{{user `username`}}"
}
],
The remote interpreter is not set appropriately
amazon-ebs:
amazon-ebs: PLAY [all] *********************************************************************
amazon-ebs:
amazon-ebs: TASK [Gathering Facts] *********************************************************
amazon-ebs: Tuesday 18 December 2018 20:40:53 +0200 (0:00:00.053) 0:00:00.053 ******
amazon-ebs: fatal: [default]: FAILED! => changed=false
amazon-ebs: module_stderr: |-
amazon-ebs: /bin/sh: 1: /usr/bin/python: not found
amazon-ebs: Shared connection to 127.0.0.1 closed.
amazon-ebs: module_stdout: ''
amazon-ebs: msg: |-
amazon-ebs: MODULE FAILURE
amazon-ebs: See stdout/stderr for the exact error
amazon-ebs: rc: 127
amazon-ebs:
amazon-ebs: PLAY RECAP *********************************************************************
amazon-ebs: default : ok=0 changed=0 unreachable=0 failed=1
amazon-ebs:
amazon-ebs: Tuesday 18 December 2018 20:40:55 +0200 (0:00:01.694) 0:00:01.748 ******
amazon-ebs: ===============================================================================
amazon-ebs: Gathering Facts --------------------------------------------------------- 1.70s
Host OS:
(issue/DEVOPS-472)*$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.1 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.1 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
*$ uname -a
Linux pkara-pc01 4.15.0-42-generic #45~16.04.1-Ubuntu SMP Mon Nov 19 13:02:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ packer -version
1.3.1
Pretty sure your extra_arguments
is wrong. It should be:
"extra_arguments": [
"-e",
"'ansible_python_interpreter=/usr/bin/python3'"
],
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Pretty sure your
extra_arguments
is wrong. It should be: