Hi all,
I have a issue about sudo password when using packer to build image and
Ansible for provisioning. The error as title.
below is my json file and playbook. Please help me resolve this issue.
packer.json
{
"builders": [
{
"type": "openstack",
"identity_endpoint": "URL://",
"tenant_name": "tenant",
"username": "hvtoan",
"password": "hvtoan",
"availability_zone": "nova",
"region": "RegionOne",
"image_name": "Test_image_Packer",
"source_image": "d3e5cbab-061d-4f7f-987d-c0d69b7e0bff",
"ssh_username": "abc",
"ssh_password": "xyz",
"flavor": "m1.small",
"security_groups": "default",
"insecure": "true",
"networks": [
"9b2bc188-4e27-4cdf-81ef-82287c3dce5c"
]
}
],
"provisioners": [
{
"type": "ansible",
"playbook_file": "./create_image.yml"
}
]
}
create_image.yml
---
- hosts: all
gather_facts: no
ignore_errors: no
become: yes
become_method: sudo
roles:
- packer_test
/etc/ansible/roles/packer_test/tasks/main.yml
---
- name: create user
become: yes
become_method: sudo
user:
name: hvtoan
comment: Huynh Toan
- name: install apache2
apt:
name: httpd
state: latest
update_cache: yes
- name: restart apache
service:
name: httpd
state: restarted
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f671b7f8-6225-4689-b9b5-4174687b8ec3%40googlegroups.com.