Re: [ansible-project] Question about source files in an Ansible Collection
The remote_src ended up being the issue with the copy. Once i removed that, I was able to copy the RPM file, then give the absolute path to the yum/dnf module, and install as expected. Thanks for the assistance! Thanks, Harry On Thursday, June 8, 2023 at 8:53:11 AM UTC-4 Vladimir Botka wrote: > On Thu, 8 Jun 2023 04:42:48 -0700 (PDT) > "lift...@gmail.com" wrote: > > > ... > > - name: Copy the RPM locally > > ansible.builtin.copy: > > src: files/mysql-connector-j-8.0.33-1.el7.noarch.rpm > > dest: /var/tmp/ > > owner: root > > group: root > > mode: 0644 > > remote_src: true > > This copy is rather confusing. You said the directory *files* is in a > role, i.e. on the controller. Now you set *remote_src: true* which > takes the source from the remote host. > > To isolate the problem. You should verify each step you make. In this > case, before you run *yum*, verify the file > */var/tmp/mysql-connector-j-8.0.33-1.el7.noarch.rpm* is present and > readable. > > -- > Vladimir Botka > -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b0558334-2ba4-4dcd-8490-7b23e01c8d47n%40googlegroups.com.
Re: [ansible-project] Question about source files in an Ansible Collection
On Thu, 8 Jun 2023 04:42:48 -0700 (PDT) "lift...@gmail.com" wrote: > ... > - name: Copy the RPM locally > ansible.builtin.copy: > src: files/mysql-connector-j-8.0.33-1.el7.noarch.rpm > dest: /var/tmp/ > owner: root > group: root > mode: 0644 > remote_src: true This copy is rather confusing. You said the directory *files* is in a role, i.e. on the controller. Now you set *remote_src: true* which takes the source from the remote host. To isolate the problem. You should verify each step you make. In this case, before you run *yum*, verify the file */var/tmp/mysql-connector-j-8.0.33-1.el7.noarch.rpm* is present and readable. -- Vladimir Botka -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20230608145250.63fea001%40gmail.com. pgpKINmHPNEdC.pgp Description: OpenPGP digital signature
Re: [ansible-project] Question about source files in an Ansible Collection
Fair enough. Then why wouldn't the following work (trying to copy the RPM to the host, then running the yum module from that path)?: - name: Config | Handle RHEL 7 MySQL Connector when: (guacamole_mysql_auth) and (ansible_distribution_major_version == '7') block: - name: Copy the RPM locally ansible.builtin.copy: src: files/mysql-connector-j-8.0.33-1.el7.noarch.rpm dest: /var/tmp/ owner: root group: root mode: 0644 remote_src: true - name: Install Latest RHEL 7 MySQL Connector ansible.builtin.yum: name: /var/tmp/mysql-connector-j-8.0.33-1.el7.noarch.rpm state: present disable_gpg_check: true - name: Remove local RPM file ansible.builtin.file: path: /var/tmp/mysql-connector-j-8.0.33-1.el7.noarch.rpm state: absent Thanks, Harry On Wednesday, June 7, 2023 at 8:10:42 PM UTC-4 Vladimir Botka wrote: > On Wed, 7 Jun 2023 11:16:35 -0700 (PDT) > "lift...@gmail.com" wrote: > > > - ansible.builtin.yum: > > name: files/mysql-connector-j-8.0.33-1.el7.noarch.rpm > > > > I even tried to copy the file locally using the copy module with the > > remote_src flag set to true, but I get the same "file not found" error. > > Absolute path on the remote host is required > > if spec.endswith('.rpm') or '://' in spec: > if '://' not in spec and not os.path.exists(spec): > res['msg'] += "No RPM file matching '%s' found on system" % spec > > > https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/yum.py#L1040 > > > -- > Vladimir Botka > -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2b1e1f92-7a44-4245-91de-65450e1eb2c7n%40googlegroups.com.
Re: [ansible-project] Question about source files in an Ansible Collection
On Wed, 7 Jun 2023 11:16:35 -0700 (PDT) "lift...@gmail.com" wrote: > - ansible.builtin.yum: > name: files/mysql-connector-j-8.0.33-1.el7.noarch.rpm > > I even tried to copy the file locally using the copy module with the > remote_src flag set to true, but I get the same "file not found" error. Absolute path on the remote host is required if spec.endswith('.rpm') or '://' in spec: if '://' not in spec and not os.path.exists(spec): res['msg'] += "No RPM file matching '%s' found on system" % spec https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/yum.py#L1040 -- Vladimir Botka -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/20230608021025.7d1fb785%40gmail.com. pgpMLO71NKjcL.pgp Description: OpenPGP digital signature
[ansible-project] Question about source files in an Ansible Collection
I have a collection that I've built with numerous roles in it. Under one of the roles, I have a files folder with some files in it used during the role execution. However, I have a situation where 2 of these files keep erroring out saying that the source isn't found. For example, I have one file that I use the unarchive module to extract it, and it works: - name: Branding | Extract the jar file ansible.builtin.unarchive: src: files/tsose.jar dest: /var/tmp/guacbranding But when I try to install an RPM that is located in the same files folder, I get an error stating that the source file is not found: - name: Install Latest RHEL 7 MySQL Connector ansible.builtin.yum: name: files/mysql-connector-j-8.0.33-1.el7.noarch.rpm state: present disable_gpg_check: true I even tried to copy the file locally using the copy module with the remote_src flag set to true, but I get the same "file not found" error. And when I check the tar file that is created and I upload to our automation hub, the files are there under files. Any ideas? Thanks, Harry -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f181c8b6-30b7-4074-b88f-3e8d2210ef78n%40googlegroups.com.