Closed okoliec closed 9 years ago
Hi @okoliec - sorry for the issue, let's see if we can fix it. Can you confirm please which branch/release you're using ?
Hello @brucellino -- I am using the release i downloaded in December not sure of the version.
ok - make sure to run with the latest version of the code: go to where you've cloned the repo and do :
git checkout dev
git pull
then run the playbook again to confirmt that you've got the same error.
Hello @brucellino I noticed a difference in the files i have from the one on the site. The roles under the Ansible directory in the one i downloaded previously has ldap and idp. The one in the current site doesn't have the idp-ldap playbooks. It seems there is a change in the files and location.
root@ansible:~/ansible-for-grid/Ansible# ansible-playbook -i inventory.ugb.sn idp-ldap.yml ERROR: found role at /root/ansible-for-grid/Ansible/roles/ldap, but cannot find /root/ansible-for-grid/Ansible/roles/ldap/tasks/main or /root/ansible-for-grid/Ansible/roles/ldap/handlers/main or /root/ansible-for-grid/Ansible/roles/ldap/vars/main or /root/ansible-for-grid/Ansible/roles/ldap/defaults/main or /root/ansible-for-grid/Ansible/roles/ldap/meta/main or /root/ansible-for-grid/Ansible/roles/ldap/library
I still got the sam
ok , it seems like you're out of sych with the repo. The release that we last tagged which we tested for these roles was v0.0.3, otherwisethe master branch should work, but some functionality is missing. I suggest that you
git fetch ; git checkout dev ; git pull
and let us know.
This the one i downloaded that am using https://github.com/SAGridOps/ansible-for-grid.git
Ah ok, you want https://github.com/AAROC/DevOps -
git clone https://github.com/AAROC/DevOps
Thanks Bruce i just downloaded
let us know how it goes and update the ticket :)
Hello @Bruce-- am getting the same error with the new one i just downloaded.
TASK: [ldap | Enable Secure Communications with the LDAP server (RedHat)] ***\ skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPI) skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPS)
TASK: [ldap | Enable protocols in sysconfig startup script (RedHat)] ****** skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPI) skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPS)
TASK: [ldap | Enable Secure Communications with the LDAP server] ****** ok: [ldap.ugb.sn] => (item=SLAPD_SERVICES) => {"backup": "", "changed": false, "item": "SLAPD_SERVICES", "msg": ""}
TASK: [ldap | Create the directory for ldap certificates] ***** ok: [ldap.ugb.sn] => {"changed": false, "gid": 105, "group": "openldap", "mode": "0755", "owner": "openldap", "path": "/etc/ldap/certs/", "size": 4096, "state": "directory", "uid": 102}
TASK: [ldap | Generate the private key for certificate request] *** skipping: [ldap.ugb.sn] ok: [ldap.ugb.sn] => {"changed": false, "cmd": "openssl genrsa -des3 -passout pass:password -out my1.key 1024", "rc": 0, "skipped": true, "stderr": false, "stdout": "skipped, since /etc/ldap/certs/my1.key exists"}
TASK: [ldap | Strip the passphrase from the key] ****** skipping: [ldap.ugb.sn] ok: [ldap.ugb.sn] => {"changed": false, "cmd": "openssl rsa -in my1.key -passin pass:password -out my.key", "rc": 0, "skipped": true, "stderr": false, "stdout": "skipped, since /etc/ldap/certs/my.key exists"}
TASK: [ldap | Create and sign the the new certificate] **** failed: [ldap.ugb.sn] => {"failed": true, "rc": 258} msg: cannot change to directory '/root/{# ldap_config_path #}/certs': path does not exist
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=14 changed=0 unreachable=0 failed=1
Ok let's see. This task is :
name: Create and sign the the new certificate
sudo: yes
shell: openssl req -new -x509 -subj '/C={{ server_country }}/ST={{ server_state }}/L={{ server_location }}/O={{ server_organization }}/CN={{ ansible_hostname }}/' -days 3650 -key my.key -out cert.crt -extensions v3_ca chdir={{ ldap_config_path }}/certs/ creates={{ ldap_config_path }}/certs/cert.crt
The error you're getting seems to be pulling in /root/{# ldap_config_path #}/certs'
instead of /etc/ldap/certs/
for some reason.
Stupid question, but you didn't modify Ansible/roles/ldap/tasks/security.yml by any chance ?
No i didnt modify anything at all. I just downloaded the new link you have and changed the inventory, group_vars and the ldap roles variable
ok - give us a git diff (if there are no sensitive information) please
root@ansible:~/DevOps/Ansible# git diff
diff --git a/Ansible/bootstrap.yml b/Ansible/bootstrap.yml
index e69de29..a788414 100644
--- a/Ansible/bootstrap.yml
+++ b/Ansible/bootstrap.yml
@@ -0,0 +1,6 @@
+---
+- name: Bootstrap the identity machines
+ hosts: all
+ remote_user: root
+ roles:
+ - bootstrap
diff --git a/Ansible/idp-ldap.yml b/Ansible/idp-ldap.yml
index b8bfc4d..c1d2476 100644
--- a/Ansible/idp-ldap.yml
+++ b/Ansible/idp-ldap.yml
@@ -1,16 +1,16 @@
---
- name: Configure the LDAP machine
hosts: ldap-servers
- remote_user: ansible
+ remote_user: root
sudo: true
roles:
- ldap
-- name: Prepare the identity machine common environment
- hosts: shibboleth-idps
- remote_user: ansible
- sudo: true
- roles:
- - fmarco76.tomcat
- - shibboleth-idp
- - fmarco76.IDPPublic
+#- name: Prepare the identity machine common environment
+# hosts: shibboleth-idps
+# remote_user: ansible
+# sudo: true
+# roles:
+# - fmarco76.tomcat
+# - shibboleth-idp
+# - fmarco76.IDPPublic
diff --git a/Ansible/roles/ldap/vars/main.yml b/Ansible/roles/ldap/vars/main.yml
index eef1abb..92b2d32 100644
--- a/Ansible/roles/ldap/vars/main.yml
+++ b/Ansible/roles/ldap/vars/main.yml
@@ -6,19 +6,20 @@ Administrator: Administrator
idp_group: idp
# The first test user
-user_cn: test
-user_sn: test
-user_given: Test
-user_initials: t
-user_email: test@test.com
+user_cn: Pathe
+user_sn: Seck
+user_given: Pathe
+user_initials: PS
+user_email: seckpa@ugb.edu.sn
# This *MUST* be different to the primary email
-user_secondary_email: test1@test.com
-user_org: 'Test Institute'
-user_country: NA
-user_registered_address: test@test.com
-user_pass: choose_a_good_pass
-useradmin_password: choose_a_good_pass
+user_secondary_email: seckpa@ugb.sn
+user_org: 'UGB'
+user_country: SN
+user_registered_address: seckpa@ugb.edu.sn
+
+user_pass: *****
+useradmin_password: *****
# Passwords
-# root_password_clear:
-# root_password: '{SSHA}YN4DR1KHnl7cSEFiG0ISc1oUOVxCYqzA'
+root_password_clear: ******
I confess I can't diagnose why the directory /root/{# ldap_config_path #}/certs
is being inserted, which means I need more info. Discussing this with @fmarco76, it seesm that the internal logic of the playbook may have missed some special case which your host falls into which we need to account for.
There are some tasks being skipped and I'd like to find out why; Can you attach the full output of the playbook please ?
I actually decided to remove everything from the remote machine and started again. Now this is the error am getting. I am not getting to the point where i got the error i posted before
root@ansible:~/DevOps/Ansible# ansible-playbook -i inventories/inventory.ugb.sn idp-ldap.yml
PLAY [Configure the LDAP machine] *****
GATHERING FACTS *** ok: [ldap.ugb.sn]
TASK: [fmarco76.firewall | Retrieve iptables rules] *** ok: [ldap.ugb.sn]
TASK: [fmarco76.firewall | Count iptables rules] ****** ok: [ldap.ugb.sn]
TASK: [fmarco76.firewall | Apply rules for the local network] ***** skipping: [ldap.ugb.sn] => (item=389) skipping: [ldap.ugb.sn] => (item=636)
TASK: [fmarco76.firewall | Apply rules for the defined network] *** skipping: [ldap.ugb.sn] => (item=389) skipping: [ldap.ugb.sn] => (item=636)
TASK: [fmarco76.firewall | Apply nat rules] *** skipping: [ldap.ugb.sn] => (item=389) skipping: [ldap.ugb.sn] => (item=636)
TASK: [fmarco76.firewall | Save iptable rules] **** skipping: [ldap.ugb.sn]
TASK: [fmarco76.firewall | Save iptable rules] **** skipping: [ldap.ugb.sn]
TASK: [ldap | Install the openldap and required Packages for RedHat] ****** skipping: [ldap.ugb.sn]
TASK: [ldap | Install the openldap and required Packages for Debian] ****** ok: [ldap.ugb.sn] => (item=slapd,ldap-utils)
TASK: [ldap | Start ldap server] ****** ok: [ldap.ugb.sn]
TASK: [ldap | Retrieve ldap server configuration] ***** ok: [ldap.ugb.sn]
TASK: [ldap | Copy modules file LDIF] ***** ok: [ldap.ugb.sn]
TASK: [ldap | Add modules (Debian)] *** failed: [ldap.ugb.sn] => {"changed": true, "cmd": ["ldapmodify", "-Y", "EXTERNAL", "-H", "ldapi:///", "-f", "/tmp/moduleadd-Deb.ldif"], "delta": "0:00:00.004702", "end": "2015-01-14 16:35:47.580638", "rc": 32, "start": "2015-01-14 16:35:47.575936"} stderr: SASL/EXTERNAL authentication started SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth SASL SSF: 0 ldap_modify: No such object (32) matched DN: cn=config stdout: modifying entry "cn=module{0},cn=config"
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=10 changed=0 unreachable=0 failed=1
ok, this seems more likely. @fmarco76 can comment on the missing DN
Hello @fmarco76 --- please do you have any solution for me
Could you try to run the following command and past here the output?
# ldapsearch -Y EXTERNAL -H ldapi:/// -b cn=config
# ldapsearch -Y EXTERNAL -H ldapi:/// -b 'cn=module{0},cn=config'
Additionally, could you post the content of the file /tmp/moduleadd-Deb.ldif from your installation machine?
Cheers, fmarco76
hello @fmarco76 ---Sorry i reinstalled the machine and started the installation again. I ma bac to my previous error that I was trying to resolve with @brucellino. See output of error
TASK: [ldap | Generate the private key for certificate request] *** changed: [ldap.ugb.sn]
TASK: [ldap | Strip the passphrase from the key] ****** changed: [ldap.ugb.sn]
TASK: [ldap | Create and sign the the new certificate] **** failed: [ldap.ugb.sn] => {"failed": true, "rc": 258} msg: cannot change to directory '/root/{# ldap_config_path #}/certs': path does not exist
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=25 changed=16 unreachable=0 failed=1
Hi @okoliec - I should have asked this before - can you send is the output of
ansible <ldap-servers> -m setup -i <inventory>
We may have to take into account different OS versions.
I hope i understand the syntax.. This is what i have done from your mail.
root@ansible:~/DevOps/Ansible# ansible inventories/inventory.ugb.sn -m setup -i inventory No hosts matched
you need to match the hosts to what is written in your inventory. See e.g. : https://github.com/AAROC/DevOps/blob/master/Ansible/inventories/inventory.identity.dev
_Sorry - I missed a syntax error here_ you should run:
ansible ldap-servers -i inventories/inventory.ugb.sn -m setup
ok thanks... see output
root@ansible:~/DevOps/Ansible/inventories# ansible ldap-servers -i inventory.ugb.sn -m setup ldap.ugb.sn | success >> { "ansible_facts": { "ansible_all_ipv4_addresses": [ "196.1.99.6" ], "ansible_all_ipv6_addresses": [ "fe80::20c:29ff:feaf:fbd3" ], "ansible_architecture": "x86_64", "ansible_bios_date": "07/30/2013", "ansible_bios_version": "6.00", "ansible_cmdline": { "BOOT_IMAGE": "/boot/vmlinuz-2.6.32-5-amd64", "quiet": true, "ro": true, "root": "UUID=436750c7-5e63-4563-9e1c-0f8a5efd1e8f" }, "ansible_date_time": { "date": "2015-01-16", "day": "16", "epoch": "1421407019", "hour": "11", "iso8601": "2015-01-16T11:16:59Z", "iso8601_micro": "2015-01-16T11:16:59.565383Z", "minute": "16", "month": "01", "second": "59", "time": "11:16:59", "tz": "GMT", "tz_offset": "+0000", "weekday": "Friday", "year": "2015" }, "ansible_default_ipv4": { "address": "196.1.99.6", "alias": "eth0", "gateway": "196.1.99.1", "interface": "eth0", "macaddress": "00:0c:29:af:fb:d3", "mtu": 1500, "netmask": "255.255.255.224", "network": "196.1.99.0", "type": "ether" }, "ansible_default_ipv6": {}, "ansible_devices": { "fd0": { "holders": [], "host": "", "model": null, "partitions": {}, "removable": "1", "rotational": "1", "scheduler_mode": "cfq", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": null, "vendor": null }, "sda": { "holders": [], "host": "SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)", "model": "Virtual disk", "partitions": { "sda1": { "sectors": "42967040", "sectorsize": 512, "size": "20.49 GB", "start": "2048" }, "sda2": { "sectors": "35155968", "sectorsize": 512, "size": "16.76 GB", "start": "42969088" }, "sda3": { "sectors": "2", "sectorsize": 512, "size": "1.00 KB", "start": "78127102" }, "sda5": { "sectors": "5756928", "sectorsize": 512, "size": "2.75 GB", "start": "78127104" } }, "removable": "0", "rotational": "1", "scheduler_mode": "cfq", "sectors": "83886080", "sectorsize": "512", "size": "40.00 GB", "support_discard": null, "vendor": "VMware" }, "sr0": { "holders": [], "host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)", "model": "VMware IDE CDR10", "partitions": {}, "removable": "1", "rotational": "1", "scheduler_mode": "cfq", "sectors": "2097151", "sectorsize": "512", "size": "1024.00 MB", "support_discard": null, "vendor": "NECVMWar" } }, "ansible_distribution": "Debian", "ansible_distribution_major_version": "6", "ansible_distribution_release": "NA", "ansible_distribution_version": "6.0", "ansible_domain": "ugb.sn", "ansible_env": { "HOME": "/root", "LANG": "C", "LANGUAGE": "fr_FR:fr", "LC_CTYPE": "C", "LOGNAME": "root", "MAIL": "/var/mail/root", "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11", "PWD": "/root", "SHELL": "/bin/bash", "SHLVL": "1", "SSH_CLIENT": "196.45.48.218 35069 22", "SSH_CONNECTION": "196.45.48.218 35069 196.1.99.6 22", "SSHTTY": "/dev/pts/0", "TERM": "xterm", "USER": "root", "": "/bin/sh" }, "ansible_eth0": { "active": true, "device": "eth0", "ipv4": { "address": "196.1.99.6", "netmask": "255.255.255.224", "network": "196.1.99.0" }, "ipv6": [ { "address": "fe80::20c:29ff:feaf:fbd3", "prefix": "64", "scope": "link" } ], "macaddress": "00:0c:29:af:fb:d3", "module": "e1000", "mtu": 1500, "promisc": false, "type": "ether" }, "ansible_eth1": { "active": false, "device": "eth1", "macaddress": "00:0c:29:af:fb:dd", "module": "e1000", "mtu": 1500, "promisc": false, "type": "ether" }, "ansible_form_factor": "Other", "ansible_fqdn": "ldap.ugb.sn", "ansible_hostname": "ldap", "ansible_interfaces": [ "lo", "eth1", "eth0" ], "ansible_kernel": "2.6.32-5-amd64", "ansible_lo": { "active": true, "device": "lo", "ipv4": { "address": "127.0.0.1", "netmask": "255.0.0.0", "network": "127.0.0.0" }, "ipv6": [ { "address": "::1", "prefix": "128", "scope": "host" } ], "mtu": 16436, "promisc": false, "type": "loopback" }, "ansible_lsb": { "codename": "squeeze", "description": "Debian GNU/Linux 6.0 (squeeze)", "id": "Debian", "major_release": "6", "release": "6.0" }, "ansible_machine": "x86_64", "ansible_memfree_mb": 3793, "ansible_memtotal_mb": 4096, "ansible_mounts": [ { "device": "/dev/sda1", "fstype": "ext3", "mount": "/", "options": "rw,errors=remount-ro", "size_available": 19703119872, "size_total": 21653712896 }, { "device": "/dev/sda2", "fstype": "ext3", "mount": "/home", "options": "rw", "size_available": 16628674560, "size_total": 17717157888 } ], "ansible_nodename": "ldap.ugb.sn", "ansible_os_family": "Debian", "ansible_pkg_mgr": "apt", "ansible_processor": [ "Intel(R) Xeon(R) CPU E5-2643 0 @ 3.30GHz" ], "ansible_processor_cores": 1, "ansible_processor_count": 1, "ansible_processor_threads_per_core": 1, "ansible_processor_vcpus": 1, "ansible_product_name": "VMware Virtual Platform", "ansible_product_serial": "VMware-56 4d 6a 6e fb 96 78 9c-44 5a 85 0e 4a af fb d3", "ansible_product_uuid": "564D6A6E-FB96-789C-445A-850E4AAFFBD3", "ansible_product_version": "None", "ansible_python_version": "2.6.6", "ansible_selinux": false, "ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBALXMU0xukjsoFtui6Xf3pixMSh7FOHOdxTK8bM7l75flS79/dl8nZA1z9dwJbNziRiipzKEBXldmqad1t63I8WnfeWVuvKtml92wCA58AJ9B+fkU8aE8W/PuxOFoDYTC4M6ku1fItVY5lcKudyh9/0gwOlA62k92THDdbx8snCS/AAAAFQCm58YTqZvhPlOvo7LFDi3elw36eQAAAIEApMDCIi+J3s9LQ/0eZsF2jYZXEGvCtlQcOb1Xm79g39Y5SnGLk0V9OGUUtrDE3yoZABtDGcX85nu5IkzCdVAcyUR9/tFS0wJwT3OMa6R3P2Dwc84SLWqJBFopxdDUjP/Gru0Z1jf/b5E8/MRX5PrmfAl5FfzDYXBX9dipTWm41vYAAACAZQhRAQzrHJoFrrxYoFpDSe7cI1y+IlpjzSKlGZorypK3tKaG6DJzHSdPytYEMaD4XslunNsbUDgh13BKLF4K2uS/hvj3JDhfyxW7612AJECCavy1UM3nftmEr+yV5Q8zPDg5PImN8iaq8RkRNmZTlNQ9H5hHQFL3iOiyMXLAQKk=", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCr3kMzZpkUZIAFbgMr6bg1+Gph1kxSFrjQnZC5rnwT9gyFHGukTeZv2oFyR8M+aOTb69Yms3Bxb/CIUKB3BihWeJbhXKW0xGGxb/z4HclVk3+0Mcvj0SKq1dj6+jqMtQwqcmUwCwaNK83TFwfcsJSmhb1t+X37qFmkZNF/tMqkgHHiMi5fplP/YSXgx9Stl8eajRevwG/nD7svxCdDGeAuMvA+P/amYoP2E98NqYW7pkdpgXBnFMlUHhzjuohXGL+rOYE+UVwvudFDh61W64XG++U3SuptPZNVsCQwX2qI0Ux7Dx8uVYdDKxB5Z9gyWX6vsPkTG6Ud1lRUESjlUXxJ", "ansible_swapfree_mb": 2810, "ansible_swaptotal_mb": 2810, "ansible_system": "Linux", "ansible_system_vendor": "VMware, Inc.", "ansible_user_id": "root", "ansible_userspace_architecture": "x86_64", "ansible_userspace_bits": "64", "ansible_virtualization_role": "guest", "ansible_virtualization_type": "VMware", "module_setup": true }, "changed": false }
Ah, ok. I think the problem is that you haven't defined an OS group to which the various hosts belong. Let me explain :
the OS-specific variables such as ldap_config_path
are kept in Ansible/group_vars/Debian-servers
and Ansible/group_vars/CentOS-servers
. If you don't specify a group in your inventory with this name, those variables won't get picked up and your playbook will fail.
you should add in the inventory
[Debian-servers:children]
ldap-servers
Make that change and re-run the playbook.
May I also suggest that you send the inventory via a pull request to the repo, so that we can keep track of it ?
@brucellino -- thanks for the explanation but i think i already have that as displayed in the output below.
root@ansible:~/DevOps/Ansible/inventories# less inventory.ugb.sn
[ldap-servers] ldap.ugb.sn
[CentOS-servers:children] ldap-servers
[Debian-servers:children]
ldap-servers
Hi - your machines can't be in both Debian and CentOS groups ;) they have to be in either one or the other (Debian, from the looks of your setup). I'm not sure that the playbook will set the variable correctly.
Can you make the change and try again ?
Hello @brucellino am still getting the same error.
TASK: [ldap | Enable protocols in sysconfig startup script (RedHat)] ****** skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPI) skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPS)
TASK: [ldap | Enable Secure Communications with the LDAP server] ****** ok: [ldap.ugb.sn] => (item=SLAPD_SERVICES)
TASK: [ldap | Create the directory for ldap certificates] ***** ok: [ldap.ugb.sn]
TASK: [ldap | Generate the private key for certificate request] *** skipping: [ldap.ugb.sn]
TASK: [ldap | Strip the passphrase from the key] ****** skipping: [ldap.ugb.sn]
TASK: [ldap | Create and sign the the new certificate] **** failed: [ldap.ugb.sn] => {"failed": true, "rc": 258} msg: cannot change to directory '/root/{# ldap_config_path #}/certs': path does not exist
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=14 changed=0 unreachable=0 failed=1
Hi @okoliec ; I just ran into a similar problem to this - it was solved using the ansible variables in "{{ }}" (note- the "").
Can you change the {{ ldap_config_path }} --> "{{ ldap_config_path }} " and let me know if the issue is resolved ? Also, what version of Ansible do you have ?
Hello @brucellino --- I noticed there a several lines with {{ldap_confg_path}} should i add the quotes to all of them. Below is the file am editing root@ansible:~/DevOps/Ansible/roles/ldap/tasks# vi security.yml
This is the version of the ansible am using: Version: 1.7.1-precise-unstable-ppa
I have 1.8 - The ansible version is probably not the issue. I'm going to make commit to the dev tree with some debugging statements - when it comes through can you do a pull and re-run the playbook please.
@brucellino-- You didnt answer my question about adding the quotes before testing.
Leave that for now, it will conflict with the pull... standby.
ok, do the pull and run the playbook - show me the debugging statement at the start of the ldap play
This the what i get... Is there a way to to tell it to ignore without overwriting
root@ansible:~/DevOps/Ansible# git pull Updating cd2347d..38071db error: Your local changes to the following files would be overwritten by merge: Ansible/roles/ldap/vars/main.yml Please, commit your changes or stash them before you can merge. Aborting
Am fine with the file. I just moved it out and replaced it after the git pull was successful.
Let me attempt to execute the play book again.
Same error
TASK: [ldap | Create and sign the the new certificate] ****
I need the whole play please, with the debug statement above.
root@ansible:~/DevOps/Ansible# ansible-playbook -i inventories/inventory.ugb.sn idp-ldap.yml -vv
PLAY [Configure the LDAP machine] *****
GATHERING FACTS ***
Ok, so it's definitely in this Certificate task; the variable openldap_config_path
is picked up fine in the other tasks and I can't reproduce the error on our local dev site here.
The only thing I can think of right now is that the "chdir" argument is not being parsed properly.
Can you change the task quickly to :
- name: Create and sign the the new certificate
sudo: yes
shell: openssl req -new -x509 -subj '/C={{ server_country }}/ST={{ server_state }}/L={{ server_location }}/O={{ server_organization }}/CN={{ ansible_hostname }}/' -days 3650 -key my.key -out cert.crt -extensions v3_ca
args:
chdir: "{{ ldap_config_path }}/certs/"
creates: "{{ ldap_config_path }}/certs/cert.crt"
and let me know the outcome ?
Hi @Bruce @Okolie, Do you think the unusable version can also be a problem? which one is recommended? I am using ansible 1.9 Rgds, Damas
On Jan 21, 2015, at 7:59 PM, Bruce Becker notifications@github.com wrote:
Ok, so it's definitely in this Certificate task; the variable openldap_config_path is picked up fine in the other tasks and I can't reproduce the error on our local dev site here.
The only thing I can think of right now is that the "chdir" argument is not being parsed properly.
Can you change the task quickly to :
- name: Create and sign the the new certificate sudo: yes shell: openssl req -new -x509 -subj '/C={{ server_country }}/ST={{ server_state }}/L={{ server_location }}/O={{ server_organization }}/CN={{ ansible_hostname }}/' -days 3650 -key my.key -out cert.crt -extensions v3_ca args: chdir: "{{ ldap_config_path }}/certs/" creates: "{{ ldap_config_path }}/certs/cert.crt" and let me know the outcome ?
— Reply to this email directly or view it on GitHub https://github.com/AAROC/DevOps/issues/152#issuecomment-70875761.
Helllo @brucellino
I am still getting the same error after the making the changes you requested.
TASK: [ldap | Create and sign the the new certificate] **** failed: [ldap.ugb.sn] => {"failed": true, "rc": 258} msg: cannot change to directory '/root/{# ldap_config_path #}/certs': path does not exist
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=15 changed=0 unreachable=0 failed=1
Hi @okoliec - let's see if it's the Ansible version... Can you do the following :
git clone --recursive https://github.com/ansible/ansible.git
source ansible/hacking/env-setup
cd DevOps/Ansible
ansible-playbook .....
:pray:
Hello @brucellino ---I got the same error after following the steps above
root@ansible:~/DevOps/Ansible# ansible-playbook -i inventories/inventory.ugb.sn idp-ldap.yml -v
PLAY [Configure the LDAP machine] *****
GATHERING FACTS *** ok: [ldap.ugb.sn]
TASK: [fmarco76.firewall | Retrieve iptables rules] *** ok: [ldap.ugb.sn] => {"changed": false, "cmd": ["iptables", "-t", "filter", "-L", "-n"], "delta": "0:00:00.002202", "end": "2015-01-22 12:03:16.702093", "rc": 0, "start": "2015-01-22 12:03:16.699891", "stderr": "", "stdout": "Chain INPUT (policy ACCEPT)\ntarget prot opt source destination \nACCEPT all -- 0.0.0.0/0 0.0.0.0/0 \nACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED \nACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 \nACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 \nACCEPT tcp -- 196.1.99.0/27 0.0.0.0/0 state NEW tcp dpt:636 \nACCEPT tcp -- 196.1.99.0/27 0.0.0.0/0 state NEW tcp dpt:389 \nREJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-admin-prohibited \n\nChain FORWARD (policy ACCEPT)\ntarget prot opt source destination \nREJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-admin-prohibited \n\nChain OUTPUT (policy ACCEPT)\ntarget prot opt source destination ", "stdout_lines": ["Chain INPUT (policy ACCEPT)", "target prot opt source destination ", "ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ", "ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ", "ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ", "ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 ", "ACCEPT tcp -- 196.1.99.0/27 0.0.0.0/0 state NEW tcp dpt:636 ", "ACCEPT tcp -- 196.1.99.0/27 0.0.0.0/0 state NEW tcp dpt:389 ", "REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-admin-prohibited ", "", "Chain FORWARD (policy ACCEPT)", "target prot opt source destination ", "REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-admin-prohibited ", "", "Chain OUTPUT (policy ACCEPT)", "target prot opt source destination "]}
TASK: [fmarco76.firewall | Count iptables rules] ****** ok: [ldap.ugb.sn] => {"changed": false, "rc": 0, "stderr": "", "stdout": "7", "stdout_lines": ["7"]}
TASK: [fmarco76.firewall | Apply rules for the local network] ***** skipping: [ldap.ugb.sn] => (item=389) skipping: [ldap.ugb.sn] => (item=636)
TASK: [fmarco76.firewall | Apply rules for the defined network] *** skipping: [ldap.ugb.sn] => (item=389) skipping: [ldap.ugb.sn] => (item=636)
TASK: [fmarco76.firewall | Apply nat rules] *** skipping: [ldap.ugb.sn] => (item=389) skipping: [ldap.ugb.sn] => (item=636)
TASK: [fmarco76.firewall | Save iptable rules] **** skipping: [ldap.ugb.sn]
TASK: [fmarco76.firewall | Save iptable rules] **** skipping: [ldap.ugb.sn]
TASK: [ldap | what are we installing?] **** ok: [ldap.ugb.sn] => { "msg": "['slapd', 'ldap-utils'] will be installed in /etc/ldap" }
TASK: [ldap | Install the openldap and required Packages for RedHat] ****** skipping: [ldap.ugb.sn]
TASK: [ldap | Install the openldap and required Packages for Debian] ****** ok: [ldap.ugb.sn] => (item=slapd,ldap-utils) => {"changed": false, "item": "slapd,ldap-utils"}
TASK: [ldap | Start ldap server] ****** ok: [ldap.ugb.sn] => {"changed": false, "enabled": true, "name": "slapd", "state": "started"}
TASK: [ldap | Retrieve ldap server configuration] *****
ok: [ldap.ugb.sn] => {"changed": false, "cmd": ["ldapsearch", "-Y", "EXTERNAL", "-H", "ldapi:///", "-b", "cn=config"], "delta": "0:00:00.005836", "end": "2015-01-22 12:05:10.756884", "rc": 0, "start": "2015-01-22 12:05:10.751048", "stderr": "SASL/EXTERNAL authentication started\nSASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth\nSASL SSF: 0", "stdout": "# extended LDIF\n#\n# LDAPv3\n# base
TASK: [ldap | Copy modules file LDIF] ***** skipping: [ldap.ugb.sn]
TASK: [ldap | Add modules (Debian)] *** skipping: [ldap.ugb.sn]
TASK: [ldap | Add modules (RedHat)] *** skipping: [ldap.ugb.sn]
TASK: [ldap | Restart ldap server] **** skipping: [ldap.ugb.sn]
TASK: [ldap | Create db LDIF] ***** ok: [ldap.ugb.sn] => {"changed": false, "gid": 0, "group": "root", "mode": "0644", "owner": "root", "path": "/tmp/db.ldif", "size": 670, "state": "file", "uid": 0}
TASK: [ldap | Customise DB] *** skipping: [ldap.ugb.sn]
TASK: [ldap | Copy Password Policy Schema ldap server (Debian)] *** skipping: [ldap.ugb.sn]
TASK: [ldap | Apply ppolicy schema] *** skipping: [ldap.ugb.sn]
TASK: [ldap | Copy Overlay LDIF] ****** skipping: [ldap.ugb.sn]
TASK: [ldap | Apply overlays] ***** skipping: [ldap.ugb.sn]
TASK: [ldap | Enable Secure Communications with the LDAP server (RedHat)] ***\ skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPI) skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPS)
TASK: [ldap | Enable protocols in sysconfig startup script (RedHat)] ****** skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPI) skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPS)
TASK: [ldap | Enable Secure Communications with the LDAP server] ****** ok: [ldap.ugb.sn] => (item=SLAPD_SERVICES) => {"backup": "", "changed": false, "item": "SLAPD_SERVICES", "msg": ""}
TASK: [ldap | Create the directory for ldap certificates] ***** ok: [ldap.ugb.sn] => {"changed": false, "gid": 105, "group": "openldap", "mode": "0755", "owner": "openldap", "path": "/etc/ldap/certs/", "size": 4096, "state": "directory", "uid": 102}
TASK: [ldap | Generate the private key for certificate request] *** skipping: [ldap.ugb.sn] ok: [ldap.ugb.sn] => {"changed": false, "cmd": "openssl genrsa -des3 -passout pass:password -out my1.key 1024", "rc": 0, "skipped": true, "stderr": false, "stdout": "skipped, since /etc/ldap/certs/my1.key exists"}
TASK: [ldap | Strip the passphrase from the key] ****** skipping: [ldap.ugb.sn] ok: [ldap.ugb.sn] => {"changed": false, "cmd": "openssl rsa -in my1.key -passin pass:password -out my.key", "rc": 0, "skipped": true, "stderr": false, "stdout": "skipped, since /etc/ldap/certs/my.key exists"}
TASK: [ldap | Create and sign the the new certificate] **** failed: [ldap.ugb.sn] => {"failed": true, "rc": 258} msg: cannot change to directory '/root/{# ldap_config_path #}/certs': path does not exist
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=15 changed=0 unreachable=0 failed=1
root@ansible:~/DevOps/Ansible#
Hello @brucellino --this is what this file looks like root@ansible:~/DevOps/Ansible# less inventories/inventory.ugb.sn
[ldap-servers] ldap.ugb.sn
[Debian-servers:children]
[identity-ugb:children] ldap-servers
root@ansible:~/DevOps/Ansible/group_vars# vi identity-ugb I noticed that with [identity-ugb:chldren] not commented out. I get an error. and no openldap package is installed with with that commented out the installation goes through and stop at the cert directory error thing Could this be where my error is coming from.
What should be contained in inventories and group_vars
Thanks
Hi @okoliec - ah ok ! You need to have a group_vars for your site. The group is defined by [identity-ugb]. In there you need to have variables which are applicable to your site. See https://github.com/AAROC/DevOps/blob/dev/Ansible/group_vars/identity-all for example
Yes i have that.
This is the error i get when i execute the playbook with this line in the inventory.ugb--- [identity-ugb:children] enabled.
TASK: [ldap | what are we installing?] **** ok: [ldap.ugb.sn] => { "msg": "{{ldap_pkgs}} will be installed in {{ldap_config_path}}" }
TASK: [ldap | Install the openldap and required Packages for RedHat] ****** skipping: [ldap.ugb.sn]
TASK: [ldap | Install the openldap and required Packages for Debian] ****** failed: [ldap.ugb.sn] => (item=ldap_pkgs) => {"failed": true, "item": "ldap_pkgs"} msg: No package matching 'ldap_pkgs' is available
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=7 changed=0 unreachable=0 failed=1
This was a missing {{ }}
which has since been fixed.
I am trying to do an installation but getting this error message below. Please any clues will be appreciated.
TASK: [ldap | Enable Secure Communications with the LDAP server (RedHat)] ***\ skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPI) skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPS)
TASK: [ldap | Enable protocols in sysconfig startup script (RedHat)] ****** skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPI) skipping: [ldap.ugb.sn] => (item=SLAPD_LDAPS)
TASK: [ldap | Enable Secure Communications with the LDAP server] ****** ok: [ldap.ugb.sn] => (item=SLAPD_SERVICES) => {"backup": "", "changed": false, "item": "SLAPD_SERVICES", "msg": ""}
TASK: [ldap | Create the directory for ldap certificates] ***** ok: [ldap.ugb.sn] => {"changed": false, "gid": 105, "group": "openldap", "mode": "0755", "owner": "openldap", "path": "/etc/ldap/certs/", "size": 4096, "state": "directory", "uid": 102}
TASK: [ldap | Generate the private key for certificate request] *** skipping: [ldap.ugb.sn]
TASK: [ldap | Strip the passphrase from the key] ****** skipping: [ldap.ugb.sn]
TASK: [ldap | Create and sign the the new certificate] **** failed: [ldap.ugb.sn] => {"failed": true, "rc": 258} msg: cannot change to directory '/root/{# ldap_config_path #}/certs': path does not exist
FATAL: all hosts have already failed -- aborting
PLAY RECAP **** to retry, use: --limit @/root/idp-ldap.retry
ldap.ugb.sn : ok=14 changed=0 unreachable=0 failed=1