The output is: ansible-playbook 2.7.10 > config file = /etc/ansible/ansible.cfg > configured module search path = > ['/home/andrea/.ansible/plugins/modules', > '/usr/share/ansible/plugins/modules'] > ansible python module location = /usr/lib/python3.7/site-packages/ansible > executable location = /usr/bin/ansible-playbook > python version = 3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 > 20181127] > Using /etc/ansible/ansible.cfg as config file > /etc/ansible/hosts did not meet host_list requirements, check plugin > documentation if this is unexpected > /etc/ansible/hosts did not meet script requirements, check plugin > documentation if this is unexpected > Parsed /etc/ansible/hosts inventory source with ini plugin > ERROR! no action detected in task. This often indicates a misspelled > module name, or incorrect module path. > The error appears to have been in > '/home/andrea/Documenti/Tirocinio/Cloudify/BluePrint/Database/database_create.yml': > > line 76, column 9, but may > be elsewhere in the file depending on the exact syntax problem. > The offending line appears to be: > > - name: Run queries from SQL script > ^ here
Il giorno venerdì 3 maggio 2019 22:04:40 UTC+2, Jonathan Lozada De La Matta ha scritto: > > can you run it with -vvv ? > > On Fri, May 3, 2019 at 3:53 PM <[email protected] <javascript:>> wrote: > >> Hi, I have to create and populate a DB with Ansible. >> I successfully create the db, but when I add the postgresql_query I got >> syntax error. >> I also tried to add the code from documentation (here >> <https://docs.ansible.com/ansible/devel/modules/postgresql_query_module.html>) >> >> but it get the same. >> >> The *error* is: >> >>> The offending line appears to be: >>> >>> - name: Run queries from SQL script >>> ^ here >> >> >> >> I put here the playbook, I really have any idea what it could be. Is it a >> bug? >> >>> >>>> - hosts: vm_database >>> >>> become: yes >>> >>> vars: >>> >>> #usate per il lancio senza Cloudify >>> >>> an_db_name: db_webserver >>> >>> #an_db_user: webserver >>> >>> #an_db_password: webserver >>> >>> tasks: >>> >>> - name: PostgreSQL installation... >>> >>> become_user: root >>> >>> package: >>> >>> name: "{{ item }}" >>> >>> state: present >>> >>> loop: >>> >>> - postgresql >>> >>> #- postgresql-contrib >>> >>> #- libpq-dev >>> >>> - python-psycopg2 >>> >>> >>>> - name: Check Cluster dir is empty.. >>> >>> register: foundFiles >>> >>> find: >>> >>> paths: /var/lib/postgres/data >>> >>> patterns: '*.*' >>> >>> >>>> - name: Launching initdb ... >>> >>> when: foundFiles.matched == 0 >>> >>> become_user: postgres >>> >>> become_flags: -i >>> >>> shell: initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data' >>> >>> >>>> - name: Set postgresql.conf to allow remote connection... >>> >>> become_user: root >>> >>> lineinfile: >>> >>> path: /var/lib/postgres/data/postgresql.conf >>> >>> regexp: "^#listen_addresses = 'localhost'" >>> >>> line: "listen_addresses = '*' " >>> >>> >>>> - name: Set pg_hba.conf to allow remote connection... >>> >>> become_user: root >>> >>> lineinfile: >>> >>> path: /var/lib/postgres/data/pg_hba.conf >>> >>> regexp: 'host.*all.*all.*0.0.0.0/0.*md5' #da sistemare, >>>> non funziona >>> >>> firstmatch: yes >>> >>> insertafter: '^# IPv4 local connections:*' >>> >>> line: "host\tall\t\tall\t\t0.0.0.0/0\t\tmd5" #controllare >>>> -> bazooka >>> >>> >>>> - name: Service launch.. >>> >>> become_user: root >>> >>> service: >>> >>> name: postgresql >>> >>> state: started >>> >>> enabled: yes >>> >>> >>>> - name:DB creation.. >>> >>> become_user: postgres >>> >>> postgresql_db: >>> >>> name: "{{ an_db_name }}" >>> >>> encoding: UTF-8 >>> >>> lc_collate: it_IT.UTF-8 >>> >>> lc_ctype: it_IT.UTF-8 >>> >>> template: template0 >>> >>> state: present >>> >>> >>>> - name: User creation.. >>> >>> become_user: postgres >>> >>> postgresql_user: >>> >>> db: "{{ an_db_name }}" >>> >>> name: "{{ an_db_user }}" >>> >>> password: "{{ an_db_password }}" >>> >>> priv: ALL >>> >>> role_attr_flags: LOGIN,CREATEDB >>> >>> state: present >>> >>> ###EVERYTHING FINE TILL HERE#### >>> >>> *- name: Run queries from SQL script...* >>> >>> * become_user: postgres* >>> >>> * postgresql_query:* >>> >>> * db: "{{ an_db_name }}"* >>> >>> * path_to_script: Resource/00-create.sql* >>> >>> * positional_args: 1* >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/5d7c4e35-e113-4e0d-a929-905ea73b8d74%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/5d7c4e35-e113-4e0d-a929-905ea73b8d74%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > > Jonathan Cha'gara Lozada De La Matta > > He / Him / His > > Automation Practice > > Senior Automation Consultant & Automation CoP Manager > > Red Hat <https://www.redhat.com> > @redhatjobs <https://twitter.com/redhatjobs> redhatjobs > <https://www.facebook.com/redhatjobs> @redhatjobs > <https://instagram.com/redhatjobs> > <https://www.redhat.com> > > > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/557c9402-b1b5-44ad-9013-88d6264ac146%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
