On 7/25/19 4:12 PM, Keith Mills wrote:
> Hi Stefan,
> 
> Thanks for the tasks! I have modified it a bit to what we use. See below:
> 
> ---
> - hosts: all
>   remote_user: root
> 
>   tasks:
>   - name: copy MyConfig.pm to the correct directory on remote host(s)
>     template:
>       src: ../../../library/conf/debian/debian-myconfig.pm
>       dest: /root/.cpan/CPAN/MyConfig.pm
>   - name: Install cpanm on Debian
>     apt:
>      name: cpanminus
>     when:
>      ansible_distribution|lower == 'debian'
>   - name: Install other prerequisites (Debian)
>     apt:
>      name:
>       - gcc
>       - make
>     when:
>      ansible_distribution|lower == 'debian'
>   - name: Install cpanm on Ubuntu
>     apt:
>      name: cpanminus
>     when:
>      ansible_distribution|lower == 'ubuntu'
>   - name: Install other prerequisites (Ubuntu)
>     apt:
>      name:
>       - gcc
>       - make
>     when:
>      ansible_distribution|lower == 'ubuntu'
>   - name: Install cpanm on RedHat
>     yum:
>      name: perl-App-cpanminus
>     when:
>      ansible_distribution|lower == 'redhat'
>   - name: Install other prerequisites (RedHat)
>     yum:
>      name:
>       - gcc
>       - make
>     when:
>      ansible_distribution|lower == 'redhat'
>   - name: Install cpanm (SUSE Linux)
>     zypper:
>      name: perl-App-cpanminus
>     when:
>      ansible_distribution|lower == 'sles'
>   - name: Install other prerequisites (SUSE Linux)
>     yum:
>      name:
>       - gcc
>       - make
>     when:
>      ansible_distribution|lower == 'sles'
>   - name: Install some CPAN modules
>     cpanm:
>      name: "{{ item }}"
>      notest: true
>     with_items:
>     - "HTTP::DAV"
>     - "Log::Log4perl"
>     - "SOAP::Lite"
>     - "Digest::SHA1"
>     - "AnyData"
>     - "Log::Dispatch::FileRotate"
>     - "Term::Shell"
>     - "Crypt::RC4"
>     environment:
>       PERL_CPANM_OPT: "--mirror http://hCPAN2.sde.rdlabs.hpecorp.net/";
> ...
> 
> 
> When I run this I get:
> 
> failed: [ubuntu12ex6401] (item=HTTP::DAV) => {"ansible_loop_var": "item", 
> "changed": false, "cmd": "/usr/bin/cpanm
> HTTP::DAV -n", "item": "HTTP::DAV", "msg": "! Finding HTTP::DAV on cpanmetadb 
> failed.\n! Finding HTTP::DAV on
> search.cpan.org failed.\n--> Working on HTTP::DAV\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/C/CO/COSIMO/HTTP-DAV-0.49.tar.gz
>  ... OK\nConfiguring HTTP-DAV-0.49 ...
> OK\n==> Found dependencies: XML::DOM\n! Finding XML::DOM on cpanmetadb 
> failed.\n! Finding XML::DOM on search.cpan.org
> failed.\n--> Working on XML::DOM\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/T/TJ/TJMATHER/XML-DOM-1.46.tar.gz
>  ... OK\nConfiguring XML-DOM-1.46 ...
> OK\n==> Found dependencies: XML::Parser::PerlSAX, XML::Parser\n! Finding 
> XML::Parser::PerlSAX on cpanmetadb failed.\n!
> Finding XML::Parser::PerlSAX on search.cpan.org failed.\n--> Working on 
> XML::Parser::PerlSAX\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/K/KM/KMACLEOD/libxml-perl-0.08.tar.gz
>  ... OK\nConfiguring
> libxml-perl-0.08 ... OK\n==> Found dependencies: XML::Parser\n! Finding 
> XML::Parser on cpanmetadb failed.\n! Finding
> XML::Parser on search.cpan.org failed.\n--> Working on XML::Parser\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz
>  ... OK\nConfiguring XML-Parser-2.44
> ... OK\nBuilding XML-Parser-2.44 ... FAIL\n! Installing XML::Parser failed. 
> See /root/.cpanm/build.log for details.\n!
> Bailing out the installation for libxml-perl-0.08. Retry with --prompt or 
> --force.\n! Bailing out the installation for
> XML-DOM-1.46. Retry with --prompt or --force.\n! Bailing out the installation 
> for HTTP-DAV-0.49. Retry with --prompt or
> --force.\n"}
> 
> failed: [ubuntu12ex6401] (item=SOAP::Lite) => {"ansible_loop_var": "item", 
> "changed": false, "cmd": "/usr/bin/cpanm
> SOAP::Lite -n", "item": "SOAP::Lite", "msg": "! Finding SOAP::Lite on 
> cpanmetadb failed.\n! Finding SOAP::Lite on
> search.cpan.org failed.\n--> Working on SOAP::Lite\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/P/PH/PHRED/SOAP-Lite-1.27.tar.gz
>  ... OK\nConfiguring SOAP-Lite-1.27 ...
> OK\n==> Found dependencies: IO::Socket::SSL, LWP::Protocol::https, 
> XML::Parser\n! Finding IO::Socket::SSL on cpanmetadb
> failed.\n! Finding IO::Socket::SSL on search.cpan.org failed.\n--> Working on 
> IO::Socket::SSL\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/S/SU/SULLR/IO-Socket-SSL-2.066.tar.gz
>  ... OK\n==> Found dependencies:
> Net::SSLeay\n! Finding Net::SSLeay on cpanmetadb failed.\n! Finding 
> Net::SSLeay on search.cpan.org failed.\n--> Working
> on Net::SSLeay\nFetching 
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/C/CH/CHRISN/Net-SSLeay-1.88.tar.gz
>  ...
> OK\nConfiguring Net-SSLeay-1.88 ... OK\nBuilding Net-SSLeay-1.88 ... FAIL\n! 
> Installing Net::SSLeay failed. See
> /root/.cpanm/build.log for details.\n! Bailing out the installation for 
> IO-Socket-SSL-2.066. Retry with --prompt or
> --force.\n! Finding LWP::Protocol::https on cpanmetadb failed.\n! Finding 
> LWP::Protocol::https on search.cpan.org
> failed.\n--> Working on LWP::Protocol::https\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/O/OA/OALDERS/LWP-Protocol-https-6.07.tar.gz
>  ... OK\nConfiguring
> LWP-Protocol-https-6.07 ... OK\n==> Found dependencies: 
> IO::Socket::SSL\nBuilding LWP-Protocol-https-6.07 ...
> OK\nSuccessfully installed LWP-Protocol-https-6.07\n! Finding XML::Parser on 
> cpanmetadb failed.\n! Finding XML::Parser
> on search.cpan.org failed.\n--> Working on XML::Parser\nFetching
> http://hCPAN2.sde.rdlabs.hpecorp.net/authors/id/T/TO/TODDR/XML-Parser-2.44.tar.gz
>  ... OK\nConfiguring XML-Parser-2.44
> ... OK\nBuilding XML-Parser-2.44 ... FAIL\n! Installing XML::Parser failed. 
> See /root/.cpanm/build.log for details.\n!
> Bailing out the installation for SOAP-Lite-1.27. Retry with --prompt or 
> --force.\n1 distribution installed\n"}
> 
> Could you help me with this failure?
> 

Hello Keith,

you need to install the following library development packages:

Debian / Ubuntu :

   - libexpat1-dev # XML::Parser
   - libssl-dev # SOAP::Lite
   - zlib1g-dev # SOAP::Lite

RedHat:

    - expat-devel # XML::Parser

Regards
         Racke

> 
> 
> 
> On Thursday, July 25, 2019 at 7:12:08 AM UTC-5, Stefan Hornburg (Racke) wrote:
> 
>     On 7/24/19 10:17 PM, Keith Mills wrote:
>     > I have my playbook for CPAN. Right now it only works for Debian. I need 
> it to work for SLES/RHEL/UBUNTU also but I
>     don't
>     > know how to add them into the playbook. Can someone please help!
>     >
>     >
> 
>     Please check the tasks below.
> 
>     Tested on:
> 
>     - Debian 9 and Debian 10
>     - CentOS 7
>     - Ubuntu Bionic (symlink /usr/bin/python3 or set 
> ansible_python_interpreter inventory variable)
>     - OpenSuSE 15
> 
>     Notes:
> 
>     - notest is true as the @INC dot removal broke a couple of Perl modules
>     - additional prerequisites might be needed for XS modules, e.g.
>     
> https://wiki.linuxia.de/library/stefan-hornburg-racke-perl-tricks-en#text-amuse-label-debianprequisites
>     
> <https://wiki.linuxia.de/library/stefan-hornburg-racke-perl-tricks-en#text-amuse-label-debianprequisites>
>     - split up the OS specific tasks into separate task files and include them
> 
>     Let me know if you have any questions.
> 
>     Regards
>               Racke
> 
>     ---
>     - hosts: all
>       become: yes
> 
>       tasks:
>         - name: Install cpanm on Debian/Ubuntu
>           apt:
>             name: cpanminus
>           when:
>             ansible_os_family == 'Debian'
>         - name: Install other prerequisites (Debian)
>           apt:
>             name:
>               - gcc
>               - make
>           when:
>             ansible_os_family == 'Debian'
> 
>         - name: Install cpanm on RedHat
>           yum:
>             name: perl-App-cpanminus
>           when:
>             ansible_os_family == 'RedHat'
> 
>         - name: Install other prerequisites (RedHat)
>           yum:
>             name:
>               - gcc
>               - make
>           when:
>             ansible_os_family == 'RedHat'
> 
>         - name: Install cpanm (SUSE Linux)
>           zypper:
>             name: perl-App-cpanminus
>           when:
>             ansible_os_family == 'Suse'
> 
>         - name: Install other prerequisites (SUSE Linux)
>           yum:
>             name:
>               - gcc
>               - make
>           when:
>             ansible_os_family == 'Suse'
> 
>         - name: Install some CPAN modules
>           cpanm:
>             name: "{{ item }}"
>             notest: true
>           with_items:
>             - DBIx::Class
>             - DateTime
>             - Dancer2
> 
> 
> 
>     > What I have:
>     >
>     > cpan-modules.yaml 
>     >
>     > ---
>     >         - hosts: gen10alltools
>     >         remote_user: root
>     >         
>     >         # Note: I am testing this script
>     >         # The intended result is to increase speed to deploy new servers
>     >         # by installing the needed CPAN modules through Ansible instead
>     >         # of the old scripts from Build Admin. Copying requirements 
> from:
>     >         # 
> E:\BuildAgent\buildagent\linux\matrix_update\12-cpan\SLES-12-x86_64.sh
>     >         
>     >         tasks:
>     >         - name: copy MyConfig.pm to the correct directory on remote 
> host(s)
>     >         template:
>     >         src: ../../../library/conf/debian/debian-myconfig.pm 
> <http://debian-myconfig.pm>
>     >         dest: /root/.cpan/CPAN/MyConfig.pm
>     >         # - name: install CPANM so the next step can install all modules
>     >         # zypper:
>     >         # name: perl-App-cpanminus
>     >         # state: present
>     >         # Commented out the CPANM install because it...doesn't work 
> right,
>     >         # did manually by executing "cpan App::cpanminus" from our 
> mirror
>     >         # install needed CPAN modules
>     >         # - cpanm: name={{ item }}
>     >         - cpanm:
>     >         name: "{{ item }}"
>     >         with_items:
>     >         - "HTTP::DAV"
>     >         - "Log::Log4perl"
>     >         - "SOAP::Lite"
>     >         - "Digest::SHA1"
>     >         - "AnyData"
>     >         - "Log::Dispatch::FileRotate"
>     >         - "Term::Shell"
>     >         - "Crypt::RC4"
>     >         environment:
>     >         PERL_CPANM_OPT: "--mirror http://hCPAN2.sde.rdlabs.hpecorp.net/ 
> <http://hCPAN2.sde.rdlabs.hpecorp.net/>"
>     >         ...
>     >
>     > --
>     > 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:> 
> <mailto:[email protected] <javascript:>>.
>     > To view this discussion on the web visit
>     > 
> https://groups.google.com/d/msgid/ansible-project/31ae91af-9d54-445c-8e1b-b583d284569c%40googlegroups.com
>     
> <https://groups.google.com/d/msgid/ansible-project/31ae91af-9d54-445c-8e1b-b583d284569c%40googlegroups.com>
>     >
>     
> <https://groups.google.com/d/msgid/ansible-project/31ae91af-9d54-445c-8e1b-b583d284569c%40googlegroups.com?utm_medium=email&utm_source=footer
>     
> <https://groups.google.com/d/msgid/ansible-project/31ae91af-9d54-445c-8e1b-b583d284569c%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> 
> 
> 
>     -- 
>     Ecommerce and Linux consulting + Perl and web application programming.
>     Debian and Sympa administration. Provisioning with Ansible.
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d2af32c7-f0ba-4120-8378-a988696501d8%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d2af32c7-f0ba-4120-8378-a988696501d8%40googlegroups.com?utm_medium=email&utm_source=footer>.


-- 
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1005688e-5ae4-5bc7-2617-9d8cff0df80d%40linuxia.de.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to