Hi,
I try to make an intance using os_server module and a cloud-config file
using the userdata parameter.
- *name: Deploy a CentOS-7 instance*
*os_server*:
cloud: myCloud
state: present
name: "{{ inventory_hostname }}"
key_name: ansible
image: 'CentOS-7'
timeout: 300
flavor: 'm1.medium'
auto_ip: no
security_groups: 'std'
meta:
hostname: "{{ inventory_hostname }}"
*userdata*: |
#cloud-config
bootcmd:
- [ cloud-init-per, once, 'bootcmd-disable-repos', 'bash', '-c'
'yum-config-manager --disable $( sed -e "/^\[/!d ; s/^\[\([^]]*\)].*$/\1/g"
/etc/yum.repos.d/*.repo ) ' ]
yum_repos:
Custom-Repos-BASE:
name: Custom Repos - CentOS-$releasever - BASE
baseurl: http://my.repos.lan/centos/$releasever/os/$basearch/
gpgcheck: true
gpgkey:
http://my.repos.lan/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
enabled: true
but on the server :
*[centos@test-t ~]$ sudo cat
/var/lib/cloud/instances/i-0000f7b6/cloud-config.txt*
#cloud-config
--- {}
...
*[centos@test-t ~]$[centos@test-t ~]$ ls -la /etc/yum**
-rw-r--r--. 1 root root 970 3 déc. 2015 /etc/yum.conf
/etc/yum:
total 28
drwxr-xr-x. 6 root root 4096 5 sept. 11:55 .
drwxr-xr-x. 78 root root 8192 9 févr. 10:03 ..
drwxr-xr-x. 2 root root 6 3 déc. 2015 fssnap.d
drwxr-xr-x. 2 root root 52 5 sept. 11:59 pluginconf.d
drwxr-xr-x. 2 root root 25 5 sept. 11:55 protected.d
drwxr-xr-x. 2 root root 18 3 déc. 2015 vars
-rw-r--r--. 1 root root 444 3 déc. 2015 version-groups.conf
-rw-r--r--. 1 root root 2534 3 déc. 2015 yum-cron.conf
-rw-r--r--. 1 root root 2496 3 déc. 2015 yum-cron-hourly.conf
/etc/yum.repos.d:
total 44
drwxr-xr-x. 2 root root 4096 3 déc. 2015 .
drwxr-xr-x. 78 root root 8192 9 févr. 10:03 ..
-rw-r--r--. 1 root root 1664 9 déc. 2015 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 9 déc. 2015 CentOS-CR.repo
-rw-r--r--. 1 root root 649 9 déc. 2015 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 290 9 déc. 2015 CentOS-fasttrack.repo
-rw-r--r--. 1 root root 630 9 déc. 2015 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 9 déc. 2015 CentOS-Sources.repo
-rw-r--r--. 1 root root 1952 9 déc. 2015 CentOS-Vault.repo
Maybe I'm wrong, but the cloud-config file should not be empty and my added
repos should be in the list.
I need to use a sort of template file as userdata parameter. In this
parameter I need to use the inventory_hostname variable (among others).
Any help please ?
Thanks
--
You received this message because you are subscribed to the Google Groups
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.