Error - "No Package MySQL-python avaiable". How to fix this?

124 views
Skip to first unread message

Prabhakaran Karuppaih

unread,
Oct 17, 2020, 1:21:02 PM10/17/20
to Ansible Project
[root@localhost playbooks]# ansible-playbook starfish.yml
[DEPRECATION WARNING]: The firewalld module has been moved to the ansible.posix
collection. This feature will be removed from community.general in version
2.0.0. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.

PLAY [starfish] ****************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [Install epel-release] ****************************************************
ok: [localhost]

TASK [Install dependencies] ****************************************************
fatal: [localhost]: FAILED! => {"changed": false, "failures": ["No package MySQL-python available."], "msg": "Failed to install some of the specified packages", "rc": 1, "results": []}

PLAY RECAP *********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

[root@localhost playbooks]#  

Dick Visser

unread,
Oct 17, 2020, 2:39:26 PM10/17/20
to ansible...@googlegroups.com
 
With the amount of context you've given it's not possible to tell.
Share the playbook, at least.


--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/a0cffd7a-1eda-4641-985a-b7aac5e6be5fn%40googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.

Prabhakaran Karuppaih

unread,
Oct 17, 2020, 8:18:03 PM10/17/20
to Ansible Project
---
- hosts: starfish
  become: yes
  vars:
# Use these on the first run of this playbook
#    current_mysql_root_password: ""
#    updated_mysql_root_password: "KingKong"
#    current_mysql_asterisk_password: ""
#    updated_mysql_asterisk_password: "KingKong"
# Comment the above out after the first run

# Uncomment these for subsequent runs
   current_mysql_root_password: "KingKong"
   updated_mysql_root_password: "KingKong"
   current_mysql_asterisk_password: "KingKong"
   updated_mysql_asterisk_password: "KingKong"

  tasks:

  - name: Install epel-release
    dnf:
      name: epel-release
      state: present

  - name: Install dependencies
    dnf:
      name: ['vim', 'wget', 'MySQL-python']
      state: present

  - name: Install the MySQL repo.
    dnf:
      state: present

  - name: Install mysql-server
    dnf:
      name: mysql-server
      state: present

  - name: Override variables for MySQL (RedHat).
    set_fact:
      mysql_daemon: mysqld
      mysql_packages: ['mysql-server']
      mysql_log_error: /var/log/mysqld.err
      mysql_syslog_tag: mysqld
      mysql_pid_file: /var/run/mysqld/mysqld.pid
      mysql_socket: /var/lib/mysql/mysql.sock
    when: ansible_os_family == "RedHat"

  - name: Ensure MySQL server is running
    service:
      name: mysqld
      state: started
      enabled: yes

  - name: update mysql root pass for localhost root account from local servers
    mysql_user:
      login_user: root
      login_password: "KingKong"
      name: root
      host: "{{ item }}"
      password: "KingKong"
    with_items:
        - localhost

  - name: update mysql root password for all other local root accounts
    mysql_user:
      login_user: root
      login_password: "KingKong"
      name: root
      host: "{{ item }}"
      password: "KingKong"
    with_items:
      - "{{ inventory_hostname }}"
      - 127.0.0.1
      - ::1
      - localhost.localdomain

  - name: create asterisk database
    mysql_db:
      login_user: root
      login_password: "KingKong"
      name: asterisk
      state: present

  - name: asterisk mysql user
    mysql_user:
      login_user: root
      login_password: "KingKong"
      name: asterisk
      host: "{{ item }}"
      password: "KingKong"
      priv: "asterisk.*:ALL"
    with_items:
      - "{{ inventory_hostname }}"
      - 127.0.0.1
      - ::1
      - localhost
      - localhost.localdomain

  - name: remove anonymous user
    mysql_user:
      login_user: root
      login_password: "KingKong"
      name: ""
      state: absent
      host: "{{ item }}"
    with_items:
        - localhost
        - "{{ inventory_hostname }}"
        - 127.0.0.1
        - ::1
        - localhost.localdomain

  - name: remove test database
    mysql_db:
      login_user: root
      login_password: "KingKong"
      name: test
      state: absent

  - user:
      name: asterisk
      state: present
      createhome: yes

  - group:
      name: asterisk
      state: present

  - user:
      name: astmin
      groups: asterisk,wheel
      state: present

  - name: Install other dependencies
    dnf:
      name:
      - unixODBC
      - unixODBC-devel
      - mysql-connector-odbc
      - MySQL-python
      - tcpdump
      - ntp
      - ntpdate
      - jansson
      - bind-utils
      state: present

  # Tweak the firewall for UDP/SIP
  - firewalld:
      port: 5060/udp
      permanent: true
      state: enabled

  # Tweak firewall for UDP/RTP
  - firewalld:
      port: 10000-20000/udp
      permanent: true
      state: enabled

  - name: Ensure NTP is running
    service:
      name: ntpd
      state: started
      enabled: yes

  # The libmyodbc8a.so file is versioned, so if you don't have version 8, see what the
  # /usr/lib64/libmyodbc<version>a.so file is, and refer to that instead
  # on your 'Driver64' line, and then run the playbook again
  - name: update odbcinst.ini
    lineinfile:
      dest: /etc/odbcinst.ini
      regexp: "{{ item.regexp }}"
      line: "{{ item.line }}"
      state: present
    with_items:
      - regexp: "^Driver64"
        line: "Driver64 = /usr/lib64/libmyodbc8a.so"
      - regexp: "^Setup64"
        line: "Setup64 = /usr/lib64/libodbcmyS.so"
  - name: create odbc.ini
    blockinfile:
      path: /etc/odbc.ini
      create: yes
      block: |
        [asterisk]
        Driver = MySQL
        Description = MySQL connection to 'asterisk' database
        Server = localhost
        Port = 3306
        Database = asterisk
        UserName = asterisk
        Password = KingKong
        #Socket = /var/run/mysqld/mysqld.sock
        Socket = /var/lib/mysql/mysql.sock
...

Dick Visser

unread,
Oct 19, 2020, 12:16:06 AM10/19/20
to ansible...@googlegroups.com
Something is wrong with the yum/dnf setup on your host. Perhaps wrong repo(s) configured, exclude patterns, or something like that. In any way not something ansible related but a host problem. 
Once you fixed that it might be a good idea to include that fix in your playbook. Or just start with clean host in known-good state where this works (as it should).


Reply all
Reply to author
Forward
0 new messages