如何使用ansible win_package模块安装带有ini文件的firefox

时间:2018-10-03 19:47:01

标签: ansible

我正在尝试使用ansible win_package像这样安装Firefox:

- name: win_package install firefox
  win_package:
    path: http://<path to exe>
    product_id: 'Mozilla Firefox'
    state: present

我需要使用ini配置文件安装firefox。我知道win_package带有参数,但是我不清楚如何将文件传递给安装程序。我将ini文件放在哪里以及如何将其传递给exe?

1 个答案:

答案 0 :(得分:0)

通过将ini文件下载到远程服务器,然后运行以下任务来使其正常工作:

use strict;
use warnings;
use Tk;
use Class::Struct;

struct MyStruct => {
    name => '$',
    group => '$'
};

my %hashOfArraysOfStruct = (
    A => [ 
        MyStruct->new(name => 'Phil', group => 'A'),
        MyStruct->new(name => 'Ian', group => 'A'),
        MyStruct->new(name => 'George', group => 'A')
    ],
    B => [ 
        MyStruct->new(name => 'Mac', group => 'B'),
        MyStruct->new(name => 'Will', group => 'B')
    ],
    C => [ 
        MyStruct->new(name => 'Cath', group => 'C'),
        MyStruct->new(name => 'Thom', group => 'C'),
        MyStruct->new(name => 'Richard', group => 'C'),
        MyStruct->new(name => 'Paul', group => 'C'),
        MyStruct->new(name => 'Nick', group => 'C')
    ]
);

my $mainWindow = MainWindow->new();

my @listOne = sort(keys %hashOfArraysOfStruct);

############################################
#Route One
#Less efficient as has to loop through all the values
#But it displays the name variable of MyStruct
my $listBox1 = $mainWindow->Scrolled("Listbox", -scrollbars => "osoe", -selectmode => "single", -listvariable => \@listOne)->pack;
my $listBox2 = $mainWindow->Scrolled("Listbox", -scrollbars => "osoe", -selectmode => "single")->pack;

$listBox1->bind('<<ListboxSelect>>' => sub {
    $listBox2->delete(0, 'end');
    for(@{$hashOfArraysOfStruct{$listBox1->get($listBox1->curselection)}}) {
        $listBox2->insert('end', $_->name);
    }
});
############################################

############################################
#Route Two
#Works but displays in the form of MyStruct=HASH(0x31d7e3c)
#my @updateableList;
#my $listBox1 = $mainWindow->Scrolled("Listbox", -scrollbars => "osoe", -selectmode => "single", -listvariable => \@listOne)->pack;
#my $listBox2 = $mainWindow->Scrolled("Listbox", -scrollbars => "osoe", -selectmode => "single", -listvariable => \@updateableList)->pack;

#$listBox1->bind('<<ListboxSelect>>' => sub {
#   @updateableList = @{$hashOfArraysOfStruct{$listBox1->get($listBox1->curselection)}};
#});
############################################

############################################
#What I would like to happen
#I would like to use route two but when the struct is displayed
#in the list box, instead of being in Route Twos format, it should
#display the name variable of MyStruct.
############################################

MainLoop;