Giter Site home page Giter Site logo

ansible-role-includecsv's People

Contributors

lqueryvg avatar mkouhei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ansible-role-includecsv's Issues

How to make the CSV filename dynamic?

hi,
thanks for the code. In your example,
- include_csv: src=path/to/fruits.csv
and you call the objects using using the csv name without the extension
with_items: "{{hostvars.localhost.fruits}}"
In above case, the registered value of the csv will become fruits and is hardcoded

But how to do this, when the filename itself is dynamic? and if I don't know the physical CSV name
for e.g.
- include_csv: src={{my_dynamic_csv}}
How to call the objects from above example? (I don't know the physical name of my_dynamic_csv )

Module not picking updated CSV file

Hello Kouhei Maeda,

Thanks for module, I wrote below code to execute the SQLPLUS against the remote DB. I have client schema names and connection string in CSV as below format.
"DB_SCHEMA","SYSTEM_USER","SYSTEM_PASSWORD","TNS_NAME","TNS_DESCRIPTION" "ClientSchema1","admin","password","server1","(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))" "ClientSchema_2","admin","password2","server2","(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server2)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))" "ClientSchema_3","admin","password2","server2","(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server2)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))"

- include_csv: src=/PATH_TO_CSV/client_schema_output.csv delimiter="," shell: source ~/.bash_profile && sqlplus -S '{{ item.SYSTEM_USER }}/{{ item.SYSTEM_PASSWORD }}@{{ item.TNS_DESCRIPTION }}' @"roles/my_role/files/client.sql" {{ item.DB_SCHEMA }} connection: local sudo: no with_items: "{{ client_schema_output }}"

However for some reason it's not picking dynamic CSV, I did see CSV got updated with latest entries but not my task, it's still running against old TNS entries.

changed: [10.202.98.198] => (item={u'DB_SCHEMA': u'ClientSchema_1', u'SYSTEM_PASSWORD': u'password', u'SYSTEM_USER': u'admin', u'TNS_DESCRIPTION': u'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))', u'TNS_NAME': u'server1'}) => { "changed": true, "cmd": "source ~/.bash_profile && sqlplus -S 'admin/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)))' @\"roles/MY_Role/files/hotfix_client.sql\" ClientSchema_1",

This is never getting changes even though I updated the CSV with new entries.
Please let me know if I am doing something wrong here.

Thank you

  • Raj

Module is broken

Unable to use module, due to error below:

{"msg": "Error: Module unable to decode valid JSON on stdin. Unable to figure out what parameters were passed", "failed": true}

Ansible 2.7.7
Python 3.6.5

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/module_utils/basic.py", line 707, in _load_params
params = json.loads(buffer.decode('utf-8'))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "action_plugins/include_csv", line 58, in
main()
File "action_plugins/include_csv", line 39, in main
supports_check_mode=True,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/module_utils/basic.py", line 846, in init
self._load_params()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/module_utils/basic.py", line 2146, in _load_params
self.params = _load_params()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible/module_utils/basic.py", line 711, in _load_params
sys.exit(1)
SystemExit: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.