Comments (7)
You need to use lookup('file_src', 'sshkey/mykey.pub')
lookup plugin. file
is the "normal" one.
from debops-tools.
No problem. I know what is happening here. The file
module is used to get the contents of a specified file. The DebOps file_src
is used to select a specific file from a set of possible paths. It was written for cases like this:
- copy:
src: '{{ lookup("file_src", "relative/path/to/file") }}'
dest: '/remote/file'
The main reason being, so that role contents could stay static and be able to be updated via git, and you could still modify what the role does externally via the configuration file.
In your case, you are using the file_src
lookup in the wrong place. You would instead need to do something like this:
sshkeys:
- '{{ lookup("file", lookup("file_src", "sshkeys/mykey.pub")) }}'
So basically, first find the absolute path to a file you want, and then get its contents. That should make it work.
from debops-tools.
After debops
script generates the ansible.cfg
configuration file, ansible
command can be used and has the same functionality that debops-task
has. I am all in favor of fixing this bug and removing debops-task
.
from debops-tools.
Great, I'll use ansible command then.
from debops-tools.
debops
command doesn't work well too, it looks like it's trying to read the old inventory file, instead of the file set in ansible.cfg
.
I think it could be something related to the function find_inventorypath
, but I'm not an expert in Python.
from debops-tools.
I'm running debops (with ansible-playbook 2.1.0.0, from fedora 21) and it looks like the myproject/.debops.cfg is not being read. If I set file-paths in .debops.cfg,
[paths]
file-paths: /home/myname/cm-sys-servers/ansible/files
[ "{{ lookup('file', 'sshkeys/mykey.pub') }}" ]
still does not find the file, but searches in the default location only:
fatal: [mymachine]: FAILED! => {"failed": true, "msg": "the file_name '/home/myname/.local/share/debops/debops-playbooks/playbooks/sshkeys/mykey.pub' does not exist, or is not readable"}
from debops-tools.
Indeed, when I use file_src, the file is found. But there is a difference between lookup('file_src', 'sshkey/mykey.pub') and lookup('file', '/home/myname/cm-sys-servers/ansible/files/sshkeys/mykey.pub'). The latter reads contents of the file, while the first only reads the path with filename. I get an invalid key specified:
sshkeys: [ "{{ lookup('file_src', 'sshkeys/mykey.pub') }}" ]
gives the following error in the log:
whereas
`sshkeys: [ "{{ lookup('file', '/home/myname/cm-sys-servers/ansible/roles/users/files/mykey.pub') }}" ]`
gives something like:
"sshkeys": ["ssh-rsa XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"], "state": "present", "system": false, "uid": 1001, "update_password": "on_create"}, "name": "users", "state": "present", "system": false}
Not sure if this is the intended behaviour or I'm doing something else wrong again. (apologies if I should be creating a new issue instead)
from debops-tools.
Related Issues (20)
- Check code signatures
- Move `debops.keyring` Python module into this repo
- Refactor Python modules
- Signed PyPI releases
- debops-update: fails when ansible_managed contains variables
- Document subcommands
- Please enlighten me how to workaround this particular failure I noted HOT 12
- MS Windows Support? HOT 5
- Update http://debops.org/ to https://debops.org/ in repo description HOT 1
- README randomly lists 1 out of 3 dependencies
- provide a commented example config of how to use template_src HOT 1
- debops-padlock unusable with encfs > 1.9 HOT 6
- Raspbian detected as Debian HOT 4
- debops-update has no --dry-run argument HOT 2
- Debops inserts faulty Ansible ppa sources into sources.list HOT 1
- ERROR! Unexpected Exception: invalid syntax (profile_tasks.py, line 68)
- Broken Link for "Getting Started Guide" HOT 3
- wrong pathes for lookup_plugins in ansible.cfg HOT 5
- quoting directories with spaces in ansible.cfg breaks with 2.7 HOT 6
- Bootstrap: Variables from group_vars/all/bootstrap.yml not getting picked up HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from debops-tools.