yum: Installroot to empty directory

Hello.

I would like to install the base CentOS to a specify directory, example to /var/centos. The directory is empty. I usage the next command in yum:

`
yum --disablerepo=‘*’ --enablerepo=‘base,updates’ --releasever=7 --installroot=/var/centos groupinstall @core

`

This command installs the base system without any problems. I want to do the same through Ansible.

In Ansible I usage the next task:

`

  • name: Install base CentOS
    yum:
    state: latest
    name: “@core
    installroot: “/var/centos/”
    disablerepo: “*”
    enablerepo: “base,updates”
    releasever: “7”
    `

When executing a playbook I recieve an error:

`
Cannot find a valid baseurl for repo: base/$releasever/x86_64

`

As I understand, the yum don’t see any repo. Ok, I make list:

`

  • name: Install base CentOS
    yum:
    list: repos
    installroot: “/var/centos/”
    `

When I execute the task I receive nothing.

Why doesn’t yum module see repos? Anybody can help me?