ansible-jenkins
ansible-jenkins copied to clipboard
Build failed due to missing data folder at root directory
Hi,
I found a fix for this but unfortunately I don't have time to pull/modify/push etc., so I figured I would put it here so you can make the quick update.
Playbook failed here:
TASK [emmetog.jenkins : Create Jenkins user] ********************************************************************************************************************************************************************************************************************************** fatal: [hostname]: FAILED! => {"changed": false, "failed": true, "msg": "useradd: cannot create directory /data/jenkins\n", "name": "ubuntu", "rc": 12}
Manual fix: If there is no /data directory on the target, create one manually.
This means that I have to add an extra step to my VM creation script to create a /data directory. Obviously that works for me for now, but it would be good to have this fixed / improve the error handling for it so other users don't run into the same issue.
Hope this helps.
In your playbook you should override the setting for jenkins_home
. Based on the error you posted I assume you are installing it on Ubuntu. If you want to use the default Jenkins work directory (defined by the jenkins_x.y.z_all.deb
) your playbook could look like
---
- name: your Jenkins install playbook
hosts: ...
vars:
# default Jenkins home
jenkins_home: /var/lib/jenkins
...
roles:
- emmetog.jenkins
I just ran into this - running on centos with yum.
You are currently setting the default in defaults/main.yml
as /data/jenkins
.
If it is the case that we must redefine the jenkins_home
variable, you should remove it from the default and error out if it is not defined. Otherwise maybe verify/create the directory ?
Just an opinion :-)